You are not logged in.

#26 2009-01-05 01:50:38

skottish
Forum Fellow
From: Here
Registered: 2006-06-16
Posts: 7,942

Re: Converting .mkv to .avi or .mpg

psilo357 wrote:

as the comand, and ffmpeg is doing something odd with the video.  The original .mkv video playtime is 1:39:13, the output mp4 playtime is 2:39:04.  Somehow it is 'slowing' the video just as I thought.  The audio plays just fine (though of course gets out of sync more and more as the video plays, to where the last hour is silent...lol)

I didn't notice this before, but there's definitely something wrong with the way the FFmpeg is dealing with the container. On the first output that you posted, it's reporting a frame rate of 1000fps. This isn't a real number; It's what FFmpeg prints when there's something wrong. The last thing that I can think of before suggesting another avenue is to force the container rate. You can't use -vcodec copy with this. Well, you can, but it's meaningless. So:

ffmpeg -i <your_input.mkv> -sameq -vcodec libx264 -ab 128k -acodec libfaac -r 23.98 <your_output.mp4>

I know that there were some problems in the past with FFmpeg and Matroska. I'm not using the version from the repos, so I can't do any tests here. Anyway, if you want to give it one more try, do a short sample with the -t 60 switch again, and post the output of the resulting file with:

ffmpeg -i <new_video_file>

Offline

#27 2009-01-05 01:52:04

skottish
Forum Fellow
From: Here
Registered: 2006-06-16
Posts: 7,942

Re: Converting .mkv to .avi or .mpg

alex_anthony wrote:

My current problem is with the level of the h.264 file
Input is 5.1, PS3's max is 4.1
I'm using AAC (what the video comes with) in an MP4
I've tried just changing the hex code (trying to trick the PS3) and using tsMuxeR
Each time, the video works on the computer, but sound without video on PS3

Tomorrow I'm going to try H264info in wine and if that doesn't work, trying to do a passthrough with x264

The 5.1 and 4.1 stuff isn't from H264; It's audio stuff. I read somewhere while looking into this thread that ps3 supports 5.1 audio. Maybe that page was wrong.

Offline

#28 2009-01-05 03:02:53

psilo357
Member
Registered: 2008-10-31
Posts: 116

Re: Converting .mkv to .avi or .mpg

ffmpeg -i movie.mp4

FFmpeg version UNKNOWN, Copyright (c) 2000-2008 Fabrice Bellard, et al.
  configuration: --prefix=/usr --enable-gpl --enable-libmp3lame --enable-libvorbis --enable-libfaac --enable-libfaad --enable-liba52 --enable-libxvid --enable-libx264 --enable-libtheora --enable-postproc --enable-shared --enable-pthreads --enable-x11grab --enable-swscale
  libavutil version: 49.7.0
  libavcodec version: 51.60.0
  libavformat version: 52.17.0
  libavdevice version: 52.0.0
  built on Jul 19 2008 23:45:56, gcc: 4.3.1 20080626 (prerelease)
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'movie.mp4':
  Duration: 00:01:01.63, start: 0.000000, bitrate: 2363 kb/s
    Stream #0.0(eng): Video: h264, yuv420p, 1280x720, 23.98 tb(r)
    Stream #0.1(und): Audio: libfaad, 48000 Hz, 5:1
Must supply at least one output file

So, its still having sync issues as well.  The video does play smoothly now, but the sound/video are still out of sync...I am going to go ahead and use same command for entire video and see how it comes out, but i doubt it will end well.  Also, what about just ripping the streams out with mkvextract.  So i would end up with a video stream in .mp4 and an audio stream that is in DTS, i'm guessing i would use .dts extension, but i don't know about that part.  Then i could use ffmpeg to encode the dts sound stream into aac pretty easily i'm guessing, something like ffmpeg -i movie.dts -ab 128k -oac libfaac movie.aac.

then how would i remux them back into a single file?  Since i did not try and play with the video stream at all, just putting the sound and video together.  I also have avidemux which seems like it would be able to do this, but i do not know how to use it.  This would actually probably end up the exact same, huh?  Since really this is what it is doing, just all in one step...Which i would like to have all in one step, so it is much easier to do...lol

Thanks so much for your help man, i would not even be this far without it.  I feel we are really close to getting it though.  I

Offline

#29 2009-01-05 06:53:20

skottish
Forum Fellow
From: Here
Registered: 2006-06-16
Posts: 7,942

Re: Converting .mkv to .avi or .mpg

You're welcome for the help.

I have a nagging suspicion that the FFmpeg version in the repos may have been from a time when matroska was just getting introduced. There were problems in the beginning. I would recommend upgrading FFmpeg, but that comes at the cost of upgrading x264 and everything else that depends on the two. It can make things tricky.

I believe that some of the tools in mkvtoolnix will allow you to split matroska files. Are these videos anything that you can share? If so, and you can get a reasonable sized sample, I'd be glad to look at it. Of course videos of questionable legal status can't be discussed here.

Offline

#30 2009-01-05 22:09:49

alex_anthony
Member
From: UK
Registered: 2007-09-25
Posts: 344

Re: Converting .mkv to .avi or .mpg

No this is H.264 profile levels, not audio channels See: http://en.wikipedia.org/wiki/H264#Levels

mkvtoolnix has mkvextract, which I use to extract the tracks - usage is like this:
(mkv file is film.mkv, video is track 1, audio is aac on track 2 - can find out with mkvinfo from mkvtoolnix)
mkvextract tracks film.mkv 1:filmvideo.264 2:filmaudio.aac

Still working on video (This is probably only a problem with HD videos)

Edit: psilo357 asked about muxing - if you want to go mp4, try MP4Box, installed as part of gpac
MP4Box -new film.mp4 -add filmvideo.264 -add filmaudio.aac -fps 23.976

Your syncing issues might be solved by specifying the fps in every command by the way

Last edited by alex_anthony (2009-01-05 22:52:55)

Offline

#31 2009-01-06 00:18:02

psilo357
Member
Registered: 2008-10-31
Posts: 116

Re: Converting .mkv to .avi or .mpg

alright, the full encode using

ffmpeg -i <your_input.mkv> -sameq -vcodec libx264 -ab 128k -acodec libfaac -r 23.98 <your_output.mp4>

came out fine and everything.  The video/audio streams are in sync.  However, it lowered the quality of the video drastically, which i do not like...original mkv size is 4.4gb, my encoded mp4 size is 1.0gb, and video has noticible artifacts in dark scenes.  I'm going to try to extract audio/video with mkvtoolnix and encode just the audio with ffmpeg, is this possible?  or would there be something better for the audio, then see if mp4box will remux them back together in sync, with full quality video.

will post on the result.

Offline

#32 2009-01-06 00:45:36

skottish
Forum Fellow
From: Here
Registered: 2006-06-16
Posts: 7,942

Re: Converting .mkv to .avi or .mpg

To remove the audio with FFmpeg, simply:

ffmpeg -i <your_input> -acodec copy -vn <your_output_file.right_extension>

Offline

#33 2009-01-06 01:36:22

psilo357
Member
Registered: 2008-10-31
Posts: 116

Re: Converting .mkv to .avi or .mpg

Alright, i got an mp4 out that works on my ps3 finally.

I extracted the video and audio streams using mkvextract from mkvtoolnix.  I named the video movie.264 and the audio movie.dts.

i then converted the audio to aac using this command

ffmpeg -i movie.dts -vcodec libfaac movie.aac

Then, after that, i remux the two back together with MP4Box with

MP4Box -new movie1.mp4 -add movie.264 -add movie.aac -fps 23.976

And its in sync, full quality, perfect.  Thanks for all the help, hopefully this will keep working for me.  It also goes very quickly, the audio encode takes a few minutes, as does the remux process.

I caught wind of a 4gb file size limitation to mp4 on ps3...is this correct does anyone know?  I have some movies up to 8gb in .mpg that play fine, so i wouldn't think so, but its possible...and if so, how would i go about compressing them and keeping them of the highest quality once i have the video.264 and audio.aac streams ready?

thanks for all the help everyone, this was awesome...i will attempt with a few more files, if all is good, i get to finally dump winblows for good!!!

peace

Offline

#34 2009-01-06 18:31:59

alex_anthony
Member
From: UK
Registered: 2007-09-25
Posts: 344

Re: Converting .mkv to .avi or .mpg

The size requirement is due to FAT32. You might be able to get more on with a DVD/BD.
Have you tried to play that video on your PS3 or just the computer?

MP4Box does have an option which splits the MP4 into files of a given duration or size - look at

man mp4box

(not man MP4Box)
for usage

Can you run

MP4Box -info film.mp4

on the MP4 you created please?

Last edited by alex_anthony (2009-01-06 18:33:33)

Offline

#35 2009-01-07 01:34:15

psilo357
Member
Registered: 2008-10-31
Posts: 116

Re: Converting .mkv to .avi or .mpg

Yes, played it on my ps3 and worked perfectly.

MP4Box -info movie1.mp4

* Movie Info *
        Timescale 600 - Duration 01:39:12.988
        Fragmented File no - 2 track(s)
        File Brand isom - version 1
        Created: GMT Tue Jan  6 00:46:24 2009

File has root IOD
Scene PL 0xff - Graphics PL 0xff - OD PL 0xff
Visual PL: AVC/H264 Profile (0x15)
Audio PL: AAC Profile @ Level 4 (0x2a)
No streams included in root OD

Track # 1 Info - TrackID 1 - TimeScale 24000 - Duration 01:39:12.988
Media Info: Language "Undetermined" - Type "vide:avc1" - 142729 samples
MPEG-4 Config: Visual Stream - ObjectTypeIndication 0x21
AVC/H264 Video - Visual Size 1280 x 720 - Profile High @ Level 4.1
NAL Unit length bits: 32
Self-synchronized

Track # 2 Info - TrackID 2 - TimeScale 48000 - Duration 01:39:12.917
Media Info: Language "Undetermined" - Type "soun:mp4a" - 279043 samples
MPEG-4 Config: Audio Stream - ObjectTypeIndication 0x40
MPEG-4 Audio AAC LC - 6 Channel(s) - SampleRate 48000
Synchronized on stream 1

Offline

#36 2009-01-07 04:32:13

psilo357
Member
Registered: 2008-10-31
Posts: 116

Re: Converting .mkv to .avi or .mpg

alex_anthony, check out this link

http://wiki.flexion.org/ConvertingMKV.html

they have a part with a small python script that converts the h264 profile from 5.1 to 4.1, maybe it will solve your problem.

Also, i now have a new problem.  I have an mp4 that i made that is 4.2gb, and will not play on the ps3.  I have done just as above, which has now worked for 3/4 videos so far.  I think the reason that it will not play is either the size limitation is real, or the fact that the original video in the .mkv was 25.000fps instead of the standard 23.976.  How would i go about 'compressing' my completed mp4 down to 23.976 fps, and also make the sound slow to stay in sync?  Not only would this get it in the right fps, but I think it will also shrink size below 4gb.  If not, how do i simply compress video to say, 3.8gb?

peace

Last edited by psilo357 (2009-01-07 04:51:06)

Offline

#37 2009-01-07 19:37:03

alex_anthony
Member
From: UK
Registered: 2007-09-25
Posts: 344

Re: Converting .mkv to .avi or .mpg

compressing would require re-encoding and losing quality
I would recommend splitting
I've seen in various places that PS3 wont play it if you split with MP4Box, but will if you split the mkv at the start with mkvmerge so you might want to try that
I'm still getting audio playing but no video. I'm going to try a couple of other files to figure out if the one I've been trying with is dodgy

Offline

Board footer

Powered by FluxBB