The purpose of this article is to show how to do that for the PS3. It may very well work on other devices, but don't blame if it doesn't :)
This article is a work in progress. Are covered so far:
- Example #1: (mkv file, H.264, AC3) --> (MPEG-2 TS file, H.264, AC3)
- Example #2: (mkv file, H.264, AC3) --> (MPEG-2 PS file, H.264, AC3)
- Example #3: (mkv file, H.264, AC3) --> (MP4 file, H.264, AAC)
- Example #4: (mkv file, H.264 level 5.1, DTS 5.1) --> (MP4 file, H.264 level 4.1, AAC)
- Example #5: (mkv file, MPEG-2 video, DTS 5.1 + AC3) --> (MPEG-2 PS file, MPEG-2 video, AC3)
- Example #6: (mkv file, MPEG-2 video, DTS 5.1 + AC3) --> (MPEG-2 PS file, MPEG-2 video, AC3 5.1)
- Example #7: (mkv file, MPEG-2 video, DTS 5.1 + AC3) --> (MP4 file, H.264 video, AAC)
Before we start, let's prepare our toolbox:
- mediainfo : the best tool to learn everything there is know on the true nature of your media files. I showed you how to build it in a previous article.
- mkvtoolnix : a collection of tools to inspect, extract and build mkv files.
ubuntu% sudo apt-get install mkvtoolnix - ffmpeg : the best general-purpose audio & video transcoding tool. I also showed you how to build it in a previous article.
- MP4Box : a nice MP4 manipulation tool, which we'll use for multiplexing.
ubuntu% sudo apt-get install gpac
- tsMuxer : another great tool for multiplexing. You can download a pre-compiled version here. Just copy the tsMuxer binary in /usr/local/bin.
Let's take at a look at what the PS3 actually supports, That way, we will avoid any unnecessary transcoding. Remember that the content we're dealing has already been compressed, so any additional processing would certainly degrade quality. Also, video encoding takes a LOT of time, especially with HD files...
According to the online manual, the PS3 supports:
- MPEG-1 video, with MPEG-1 layer 2 audio
- MP4 container : H.264/MPEG-4 AVC High Profile video, with AAC LC audio
- MPEG-2 PS container (aka VOB file): MPEG-2 video, with either one of these audio formats : MPEG-2 Audio Layer 2, AAC LC, AC3 (Dolby Digital), LPCM audio
- MPEG-2 TS container :
- MPEG-2 video, with either one of these audio formats : MPEG-2 Audio Layer 2, AAC LC, AC3 (Dolby Digital)
- H.264/MPEG-4 AVC video, with AAC LC audio
- AVCHD, AVI, DivX and VC-1 (WMV), which are less likely to be encountered in mkv files.
- Obviously, the PS3 does not support the mkv container. Any input file in this format must be at least remuxed.
- The PS3 does support DTS audio, but only when played from actual disks, i.e. not from files. Thus, any input stream in this format must be transcoded.
- MP3 audio, Vorbis audio and so on are not supported and must be transcoded.
- If you want AC3 audio, you must use a MPEG-2 TS/PS container.
- If you want to stick with the MP4 container, you really have no options but H.264 video and AAC audio.
Now that we know what is supported and what isn't, we can pick the right solution, i.e. preserve the quality of the input file and save time.
The approach will always be the same:
- inspect the mkv file and identify the nature of its streams,
- extract the video stream and the audio stream (possibly among several available ones)
- depending on what your audio setup supports, select a format for the audio output (AC3 will do you no good if you don't have a Dolby Digital setup)
- based on the previous item and on what the PS3 supports, transcode the audio and/or video stream
- remux the audio and the video stream into a container supported by the PS3
- play the file :)
4) Example #1: (mkv file, H.264, AC3) --> (MPEG-2 TS file, H.264, AC3)
Let's look at our input file with mediainfo (edited for brevity):
ubuntu% mediainfo video.mkv
General
Complete name : video.mkv
Format : Matroska
File size : 1.09 GiB
Duration : 41mn 48s
Overall bit rate : 3 740 Kbps
Video
Format : AVC
Format/Info : Advanced Video Codec
Format profile : High@L3.1
Codec ID : V_MPEG4/ISO/AVC
Width : 1 280 pixels
Height : 720 pixels
Frame rate : 23.976 fps
Audio
Format : AC-3
Format/Info : Audio Coding 3
Codec ID : A_AC3
Channel(s) : 6 channels
Channel positions : Front: L C R, Surround: L R, LFE
You can also use mkvinfo (part of the mkvtoolnix package):
ubuntu% mkvinfo video.mkv
| + Track number: 1
| + Track type: video
| + Codec ID: V_MPEG4/ISO/AVC
| + Video track
| + Pixel width: 1280
| + Pixel height: 720
| + Track number: 2
| + Track type: audio
| + Codec ID: A_AC3
So what is this file? It's a 2-track mkv file: track 1 is H.264 video (1280x720), track 2 is AC3 6-channel audio. Both formats are supported by the PS3, and since they're high quality it would be a shame to transcode them. Let's try a simple remuxing into... no, not MP4 because it doesn't support AC3: we have to use MPEG-2 TS.This is where tsMuxer comes in. The good thing about it is that we don't have to extract the individual streams, this will be handled for us.
Although tsMuxer is a command-line tool, it can only read its parameters from a file (let's call it tsmuxer.meta):
MUXOPT --no-pcr-on-video-pid --new-audio-pes --vbrIgnore the first line and look at the next two. On each of them, we're describing a stream and telling tsMuxer what format it is and where to find it (file name and track number). Don't worry, this information is dumped by mediainfo or mkvinfo (go back and check), so you shouldn't have any problem writing the file :)
V_MPEG4/ISO/AVC, video.mkv, level=4.1, insertSEI, contSPS, track=1, lang=eng
A_AC3, video.mkv, track=2, lang=eng
Now, we're ready to remux:
ubuntu% tsMuxeR tsmuxer.meta video.m2ts
output removed
Mux successful complete.
Muxing time: 5 min 25 sec
That's all: this file plays fine on the PS3 (I'm streaming it right now using mediatomb). Total time: about 10 minutes. And we preserved the original quality of the input file.
5) Example #2: (mkv file, H.264, AC3) --> (MPEG-2 PS file, H.264, AC3)
Here, we'll use the same input file as example #1, but we'll remux it to MPEG2-PS (aka the VOB format). This is also interesting if you want to do without tsMuxer.
Wouldn't it be nice to be able to just do this?
ubuntu% ffmpeg -i video.mkv -acodec copy -vcodec copy -r 23.976 -f vob video.mpg
[NULL @ 0x8076d00]error, non monotone timestamps 15030 >= 7470
av_interleaved_write_frame(): Error while opening file
As you can see, it doesn't work. Not sure why... Let's use a two-step solution instead. First, let's extract the streams from the mkv file:
ubuntu% mkvextract tracks video.mkv 1:video.h264 2:audio.ac3
Now, let's remux the streams into a MPEG2-PS container:
ubuntu% ffmpeg -i video.h264 -i audio.ac3 -map 0.0:0 -map 1.0:0 -acodec copy -vcodec copy -r 23.976 -f vob video.mpg
That's it. This solution is a little bit longer than the previous one, but it works and doesn't require you to write the tsMuxer meta file :)
6) Example #3: (mkv file, H.264, AC3) --> (MP4 file, H.264, AAC)
Here, we'll also use the same input file as example #1. For whatever reason, we need to use the MP4 container (maybe to be able to play that file on another device). This means that we must also drop AC3 in favor of AAC.
We have already inspected the file, so let's extract the streams:
ubuntu% mkvextract tracks video.mkv 1:video.h264 2:audio.ac3
Then, we need to transcode the audio stream to AAC (let's use high-quality VBR):
ubuntu% ffmpeg -i audio.ac3 -acodec libfaac -aq 255 -ar 44100 -ac 2 -async 1 -vsync 1 audio.aac
Now, we'll use MP4Box to remux the initial video stream and the new audio stream into an MP4 container:
ubuntu% MP4Box -new -add audio.aac -add video.h264 -fps 23.976 video.mp4
AAC import - sample rate 44100 - MPEG-4 audio - 2 channels
AVC-H264 import - frame size 1280 x 720 at 23.976 FPS
Import results: 60146 samples - Slices: 1027 I 36894 P 22225 B - 1 SEI - 968 IDR
Stream uses B-slice references - max frame delay 2
Saving video-ps3.mp4: 0.500 secs Interleaving
That's it :)
7) Example #4: (mkv file, H.264 level 5.1, DTS 5.1) --> (MP4 file, H.264 level 4.1, AAC)
Here, we'll use a new sample file (for the sake of brevity, I will just display the relevant lines):
ubuntu% mediainfo video2.mkvOK, so track 1 is H.264 video and track 2 is DTS audio. Let's extract them:
General
Complete name : video2.mkv
Format : Matroska
Video
Format : AVC
Format/Info : Advanced Video Codec
Format profile : High@L5.1
Muxing mode : Container profile=Unknown@5.1
Codec ID : V_MPEG4/ISO/AVC
Frame rate : 23.976 fps
Audio
Format : DTS
Format/Info : Digital Theater Systems
Codec ID : A_DTS
ubuntu% mkvinfo video2.mkv
| + A track
| + Track number: 1
| + Track type: video
| + Codec ID: V_MPEG4/ISO/AVC
| + A track
| + Track number: 2
| + Track type: audio
| + Codec ID: A_DTS
ubuntu% mkvextract tracks video2.mkv 1:video.h264 2:audio.dts
According to what I've said earlier, H.264 is supported, so all we have to do is to transcode the audio... right?Wrong :) Take another look at the video stream: format profile is "High @ Level 5.1" (note: this has nothing to do with 5.1 audio!). Unfortunately, the PS3 cannot play anything above Level 4.1, so this video stream needs to be fixed. Does this mean we have to reencode it and lose quality?
Nope :) We're going to change the level right in the binary file. For this purpose, you need an hexadecimal editor. I recommend ghex2, which can easily be installed with 'sudo apt-get install ghex'.
just go 'ghex2 video.h264' and look at the first 8 bytes of the file: they should read '00 00 00 01 67 64 00 33'. Hmm... 0x33 in decimal is '51', which means 'level 5.1' : let's change this byte to 0x29 ('41' in decimal) to 'downgrade' the video to level 4.1 and save the file.
Now, let's take care of the audio stream. As above, we'll use high quality VBR:
ubuntu% ffmpeg -i audio.dts -acodec libfaac -aq 255 -ar 44100 -ac 2 -async 1 -vsync 1 audio.aac
The last operation is to remux the initial video stream and the new audio stream into an MP4 container:
ubuntu% MP4Box -new -add audio.aac -add video.x264 -fps 23.976 video.mp4
That's it. I'm not sure the level hack will always work, but it did in this case and we avoided any video transcoding.8) Example #5: (mkv file, MPEG-2 video, DTS 5.1+ AC3) --> (MPEG-2 PS file, MPEG-2 video, AC3)
Let's take a look at this one (output edited for brevity)
ubuntu% mediainfo video3.mkvTrack #1 is full HD MPEG-2 video, track #2 is DTS audio in Russian and track #3 is AC3 audio in English. Let's extract them:
General
Complete name : video3.mkv
Format : Matroska
File size : 73.9 MiB
Duration : 50s 240ms
Overall bit rate : 12.3 Mbps
Video
Format : MPEG Video
Format version : Version 2
Format profile : Main@High
Format settings, Matrix : Default
Codec ID : V_MPEG2
Width : 1 920 pixels
Height : 1 080 pixels
Audio #1
Format : DTS
Format/Info : Digital Theater Systems
Codec ID : A_DTS
Language : Russian
Audio #2
Format : AC-3
Format/Info : Audio Coding 3
Codec ID : A_AC3
Language : English
ubuntu% mkvinfo video3.mkv
| + Track number: 1
| + Track type: video
| + Codec ID: V_MPEG2
| + Track number: 2
| + Track type: audio
| + Codec ID: A_DTS
| + Track number: 3
| + Track type: audio
| + Codec ID: A_AC3
ubuntu% mkvextract tracks video3.mkv 1:video.mpeg 2:audio.dts 3:audio.ac3
If like me you don't speak Russian, you'll pick track #3 :) If you do speak Russian, please refer to the next example for DTS-->AC3 conversion.
One option would be to remux tracks #1 and #3 into an MPEG-2 TS container (like we did in example #1). Unfortunately, tsMuxer chokes on the video stream ('Can't detect stream type').
Let's try to remux in an MPEG-2 PS container. For this, we'll use ffmpeg but without any transcoding:
ubuntu% ffmpeg -i video.mpeg -i audio.ac3 -map 0.0:0 -map 1.0:0 -acodec copy -vcodec copy -f vob video.mpg
That's it!9) Example #6: (mkv file, MPEG-2 video, DTS 5.1 + AC3) --> (MPEG-2 PS file, MPEG-2 video, AC3 5.1)
We'll use the same input file as in example #5, but this time we'll use convert the DTS audio stream and convert it to AC3.
Let's take another look at the DTS stream:
ubuntu% mediainfo audio.dts
General
Complete name : audio.dts
Format : DTS
Format/Info : Digital Theater Systems
File size : 9.04 MiB
Duration : 49s 381ms
Overall bit rate : 1 536 Kbps
Audio
Format : DTS
Format/Info : Digital Theater Systems
Bit rate mode : Constant
Bit rate : 1 536 Kbps
Channel(s) : 6 channels
Channel positions : Front: L C R, Surround: L R, LFE
Sampling rate : 48.0 KHz
Resolution : 16 bits
Since the DTS stream has 6 channels, we can either transcode it to 2-channel AC3 or 6-channel AC3. Let me show you both:
ubuntu% ffmpeg -i audio.dts -acodec ac3 -ar 48000 -ab 448k -ac 2 audio-2ch.ac3
ubuntu% ffmpeg -i audio.dts -acodec ac3 -ar 48000 -ab 448k -ac 6 audio-6ch.ac3
448 KBit/s is the maximum authorized AC3 bitrate for DVDs. However, with the Playstation 3, we could go up to 640Kbit/s.
Now, let's remux the video and audio streams (I'll use 6-channel AC3 here):
ubuntu% ffmpeg -i video.mpeg -i audio-6ch.ac3 -map 0.0:0 -map 1.0:0 -acodec copy -vcodec copy -f vob video.mpg
That's it.10) Example #7: (mkv file, MPEG-2 video, DTS 5.1 + AC3) --> (MP4 file, H.264 video, AAC)
We'll use the same input file as in example #5. Let's assume that - like in example #3 - we need to use the MP4 container. This means that we must convert the video stream to H.264 and our preferred audio stream (AC3 for this purpose) to AAC.
Please note that this is not the best option! The video compression will be lossy and all the longer that we're dealing with a 1920x1080 video stream. As far as audio is concerning, we're moving from 6-channel AC3 to stereo AAC. So, unless you really need the MP4 container, I strongly suggest that you use the solution described in example #6.
Anyway, let's get started and extract the MPEG-2 and AC3 streams:
ubuntu% mkvextract tracks video3.mkv 1:video.mpeg 3:audio.ac3
Then, let's encode the audio stream to AAC:
ubuntu% ffmpeg -i audio.ac3 -acodec libfaac -aq 255 -ar 44100 -ac 2 -async 1 -vsync 1 audio.aac
Now, the big one: encoding the MPEG-2 stream to H.264:
ubuntu% ffmpeg -i video.mpeg -f rawvideo - | x264 --level 4.1 --crf 21 --bframes 16 --b-pyramid --ref 4 --mixed-refs --weightb --partitions all --threads 2 -o video.h264 - 1920x1080
Let's explain this line a bit: as you can see, we're using ffmpeg to decode the video stream to raw video and we're piping the output into the x264 encoder. The reason for this is avoid any H.264 default value that could be set by ffmpeg: indeed, piping guarantees that all H.264 flags will be set by x264.
What about the x264 flags? '--level 4.1' sets the H.264 level (the PS3 can't play anything above 4.1, please see example #4 for more information). '--crf 21' select Constant Rate Factor encoding, with default quality. '--bframes 16 --b-pyramid --ref 4 --mixed-refs --weightb --partitions all' are frame options which seem to strike the right balance between quality and encoding time (please see this article for more information). Finally, '--threads 2' will create 2 encoding threads.
FYI, on a dual-core PC @ 1.83 GHz, this command took 8 minutes to encode a 50-second video! Now you understand why you don't want to do this unless you have no other option.
Now, the final step: remuxing into an MP4 container
ubuntu% MP4Box -new -add video.h264 -add audio.aac -fps 25 video.mp4
That's it!
11) What's next
These examples should get you started. I will be adding tips and tricks as I am faced with increasingly hostile mkv files ;) In the meantime, have fun and as always, all comments welcome.
Updated 2009/01/16: this post has more advanced information on DTS to AC3 conversion.
I knew bookmarking your blog was a good idea. Meant to request a matroska for ps3 howto today, but what do you know, it was already here =) I'll give this a try at once.
ReplyDeleteJuju, are you sure about these 2 sentences ?:
ReplyDelete". MP3 audio, Vorbis audio and so on are not supported and must be transcoded.
and
. If you want to stick with the MP4 container, you really have no options but H.264 video and AAC audio"
MP3 and MP4 video are codecs, no matter the file format that encapsulate them. If the PS3 is capable of playing MP3 files and MPEG-4 video, as it is actually, it should be able to decode such stream if they are included inside supported file formats.
i.e.:the good old Avi files containing XVid video (Mpeg-4 part 2 video) and MP3 audio are (very) well played ;)
Nevermind, mkv is great but not supported by most of the "multimedia" devices, and thus it is a pain in the ass to have to transcode them.
Just on last thing: if your Mkv files contains H264 video, it should be better not to transcode it, but just extract the video track and replace it into an MP4 container (for the audio it seems you have no choice).
There I don't know about extracting track from the mkv file. but to create an MP4 file you have the excellent (and opensource) MP4Box tool to do it (and more)!!
Ltr
Boz
and yes, before reacting I will read the complete post before! Forget about my "Nevermind..." sentence, useless !:)
ReplyDeleteHi Boz,
ReplyDeletethe PS3 is really picky. Not all container / codec combinations work, even if they're theoretically possible. Since the PS3 documentation is rather vague, you really have to experiment to check what is really supported!
Cheers.
OK, thank for the info :)
ReplyDeleteI'll do some testing with various test files (got a lot here ;) ) and post my results here :D
Great content again JS :)
ReplyDeleteOK, I've done some quick testing yesterday eve. All these files were .mp4 files.
ReplyDeletehere are the info listed by mp4creator1.3:
Track Type Info
1 video H264 Main@5.1, 71.000 secs, 2547 kbps, 720x576 @ 24.000000 fps
2 audio MPEG-4 AAC LC, 70.913 secs, 115 kbps, 44100 Hz
1 video H264 Main@5.1, 71.000 secs, 2547 kbps, 720x576 @ 24.000000 fps
These 2 files were not recognized on the PS3.(profile 5.1, I haven't changed it to test if with another if worked, but I suppose it will)
here are various files, who worked perfectly on the PS3. I used various H264 setting (baseline, main CAVLC and CABAC)
1 video MPEG-4 Unknown Profile(0), 101.819 secs, 2925 kbps, 720x576 @ 24.857836 fps
2 audio MPEG-4 AAC LC, 101.742 secs, 127 kbps, 48000 Hz
1 video H264 Main@1.3, 61.920 secs, 258 kbps, 320x240 @ 50.000000 fps
201 video H264 Main@3, 121.799 secs, 1160 kbps, 720x576 @ 25.000205 fps
65335 hint Payload H264 for track 201
101 audio MPEG-4 AAC LC, 121.799 secs, 64 kbps, 48000 Hz
65435 hint Payload mpeg4-generic for track 101
1 od Object Descriptors
2 scene BIFS
201 video MPEG-4 Simple @ L3, 30.037 secs, 256 kbps, 352x242 @ 9.987682 fps
65335 hint Payload MP4V-ES for track 201
101 audio MPEG-4 AAC LC, 30.037 secs, 128 kbps, 48000 Hz
65435 hint Payload mpeg4-generic for track 101
1 od Object Descriptors
2 scene BIFS
201 video H264 Baseline@1.2, 30.037 secs, 256 kbps, 352x240 @ 9.987682 fps
65335 hint Payload H264 for track 201
101 audio MPEG-4 AAC LC, 30.037 secs, 128 kbps, 48000 Hz
65435 hint Payload MP4A-LATM for track 101
1 video MPEG-4 Unknown Profile(0), 106.333 secs, 1069 kbps, 480x208 @ 24.000075 fps
2 audio MPEG-4 AAC LC, 106.254 secs, 110 kbps, 44100 Hz
3 hint Payload MP4V-ES for track 1
4 hint Payload mpeg4-generic for track 2
1 audio MPEG-4 AAC LC, 212.160 secs, 128 kbps, 44100 Hz
2 video H264 Baseline@1.3, 212.166 secs, 257 kbps, 352x288 @ 30.000094 fps
3 hint Payload mpeg4-generic for track 1
4 hint Payload H264 for track 2
1 audio MPEG-4 AAC LC, 212.160 secs, 128 kbps, 44100 Hz
2 video MPEG-4 Unknown Profile(0), 212.200 secs, 1258 kbps, 352x288 @ 15.000000 fps
3 hint Payload mpeg4-generic for track 1
4 hint Payload MP4V-ES for track 2
By the Way, Juju, are you planing to invest the video sector at Digiplug, for doing such a profiling?
Hey Boz,
ReplyDeletethe PS3 can't go beyond H.264 level 4.1. According to Wikipedia (http://en.wikipedia.org/wiki/H.264#Profiles), High@4.1 is 1920x1080 at 30.1 fps... I don't think we need anymore than that! I guess some files are encoded at High@5.1 even it it's not really needed.
Example #4 in the post shows how to hack the level in the MP4 binary, but if the file really has 5.1 properties (macroblocks, resolution, etc), I guess the PS3 will choke on it. I should try :)
As far as your other videos are concerned, I'm not surprised: I've never had any issues with Baseline or Main.
Thanks for the tests :)
PS: Digiplug or not, how could I NOT be curious about digital video? I'm a total geek, remember? ;)
@Paul-S: thanks! It's a fascinating topic and I really enjoy sharing this with you guys :)
ReplyDelete>PS: Digiplug or not, how could I NOT be curious about digital video? I'm a total geek, remember? ;)
ReplyDeleteHahaha! It's getting worst since you've got this PS3 ;)
Boz
Another example how picky the ps3 is. I downloaded a tv-serie. I didn rip it myself. My ps3 won;t play the first 3 seasons but it will play the rest. All episodes are ripped in Divx5/Lame and should play on the ps3. Thanks to mediainfo I found there was actually a difference.
ReplyDeleteGeneral
Complete name : A.Touch.Of.Frost.s03e03.Dead.Male.One.avi
Format : AVI
Format/Info : Audio Video Interleave
File size : 700 MiB
Duration : 1h 41mn
Overall bit rate : 968 Kbps
Writing application : VirtualDubMod 1.5.10.1 (build 2439/release)
Writing library : VirtualDubMod build 2439/release
Video
Format : MPEG-4 Visual
Format settings, BVOP : Yes
Format settings, QPel : No
Format settings, GMC : 2 warppoints
Format settings, Matrix : Default
Muxing mode : Packed bitstream
Codec ID : DX50
Codec ID/Hint : DivX 5
Duration : 1h 41mn
Bit rate : 833 Kbps
Width : 544 pixels
Height : 416 pixels
Display aspect ratio : 4/3
Frame rate : 25.000 fps
Resolution : 24 bits
Colorimetry : 4:2:0
Scan type : Progressive
Bits/(Pixel*Frame) : 0.147
Stream size : 603 MiB (86%)
Writing library : DivX 5.2.1 (WaffleDay) (UTC 2004-09-08)
Audio
Format : MPEG Audio
Format version : Version 1
Format profile : Layer 3
Codec ID : 55
Codec ID/Hint : MP3
Duration : 1h 41mn
Bit rate mode : Variable
Bit rate : 122 Kbps
Nominal bit rate : 128 Kbps
Channel(s) : 2 channels
Sampling rate : 48.0 KHz
Resolution : 16 bits
Stream size : 88.1 MiB (13%)
Alignment : Aligned on interleaves
Interleave, duration : 24 ms (0.60 video frame)
Interleave, preload duration : 506 ms
Writing library : LAME3.90.
Encoding settings : ABR
mediainfo A\ Touch\ Of\ Frost\ s03e04\ No\ Refuge.avi
General
Complete name : A Touch Of Frost s03e04 No Refuge.avi
Format : AVI
Format/Info : Audio Video Interleave
File size : 700 MiB
Duration : 1h 41mn
Overall bit rate : 966 Kbps
Writing application : VirtualDubMod 1.5.10.1 (build 2439/release)
Writing library : VirtualDubMod build 2439/release
Video
Format : MPEG-4 Visual
Format settings, BVOP : Yes
Format settings, QPel : No
Format settings, GMC : No warppoints
Format settings, Matrix : Default
Muxing mode : Packed bitstream
Codec ID : DX50
Codec ID/Hint : DivX 5
Duration : 1h 41mn
Bit rate : 830 Kbps
Width : 544 pixels
Height : 408 pixels
Display aspect ratio : 4/3
Frame rate : 25.000 fps
Resolution : 24 bits
Colorimetry : 4:2:0
Scan type : Progressive
Bits/(Pixel*Frame) : 0.150
Stream size : 602 MiB (86%)
Writing library : DivX 5.2.1 (WaffleDay) (UTC 2004-09-08)
Audio
Format : MPEG Audio
Format version : Version 1
Format profile : Layer 3
Codec ID : 55
Codec ID/Hint : MP3
Duration : 1h 41mn
Bit rate mode : Variable
Bit rate : 123 Kbps
Nominal bit rate : 128 Kbps
Channel(s) : 2 channels
Sampling rate : 48.0 KHz
Resolution : 16 bits
Stream size : 89.5 MiB (13%)
Alignment : Aligned on interleaves
Interleave, duration : 24 ms (0.60 video frame)
Interleave, preload duration : 510 ms
Writing library : LAME3.90.
Encoding settings : ABR
The problem is Format settings, GMC : 2 warppoints
First 3 seasons all have 2 warppoint the others seasons don't. And that is whey it won't play on my ps3
@Bert: yeah, advanced Divx/Xvid options (GMC, QPEL, etc) are a real pain, as they are poorly supported on consumer devices. I'm afraid you can't escape retranscoding...
ReplyDeleteHi Julien.
ReplyDeleteI'm a regular visitor on you blog now because of your great howto's.
Now I'm trying to make a PS3 playable of a mkv (H264 @5.1 + AC3).
After I've "downgraded" to 4.1 I use the command in example 5 but I get lots of buffer underflow:
[vob @ 0x83202c0]buffer underflow i=0 bufi=294076 size=309001
[vob @ 0x83202c0]packet too large, ignoring buffer limits to mux it
I'm using ffmpeg 0.5. Do you have any idea what might cause this? Is it some kind of buffer preset for vob that can't handle 720p?
Any ideas?
Cheers, Alex
Hi Alex,
ReplyDelete"downgrading" from 5.1 to 4.1 does not always work. It's really a dirty hack to avoid re-encoding, but I'm afraid you have no other choice here...
Thanks Julien for the reply. I managed to remux the 720p mkv with tsMuxeR straight from the source. It seems it handled the "downgrade" itself.
ReplyDeleteBut I can't get ffmpegthumbnailer to work with the generated m2ts file. Seems to be some kind of bug in ffmpeg but I'm not sure. Otherwise playing the file using mediatomb works flawless :)
If I instead remux to a mp4 container I also get the thumbnail to work.
This is truly an art for the patient. Beware ppl with high blood pressure ;)
Hi Julien,
ReplyDeleteFirst of all, thanks a lot for your post.
Do you know if it is possible to leave a subtitle track or embed subtitles in the final output file?
TIA
Rolando
Guatemala
Hi Rolando,
ReplyDeleteGuatemala: I like that :) Anyway, AFAIK, the PS3 cannot read subtitle files. You have to hardcode them into the video file, which means retranscoding it...
Thanks for your nice tutorial! Anyway, in your example #4, there is a minor error in that in the final operation the name of the video file is wrong, it should be video.h264, not video.x264. I guess you renamed it after hex editing? However, all the mp4s I have produced this way are out of sync! Well, I didn't do the hex editing part, but it shouldn't matter, right? The simpler, one-way step to convert mkv to avi without any audio-video sync problems is simply to use:
ReplyDeletemencoder *.mkv -ffourcc XVID -ovc lavc -lavcopts vcodec=mpeg4:threads=8:vbitrate=3000 -oac copy -o movie.avi
I just wanted to convert my mkv to any filetype my tv understands and play by copying it to an USB-stick. But this is not what you meaned?
Great tutorial! I just wanted to add one tip which may help others -- if you get I/O error while remuxing with MP4Box, make sure that the partition on which your /tmp resides has enough space to hold equivalent of the video file you're remuxing.
ReplyDeleteFor example, if you're remuxing a 2GB video file, and a 1GB audio file, you should have an extra 4GB free on the partition where you /tmp partition is. Otherwise, you'll run out of room and the job will fail.
Alternatively, you can tell MP4Box to use some other location as tmp storage by using -tmp /some/path
good article, though I am unable to reproduce example 5. I know, it is a bit late and everyone uses tsMuxeR but what about those people (like me), who like using their old powerbook g4 or mac mini g4, etc? Is there really no way of remuxing mkv to m2ts?
ReplyDeleteI tried every thinkable version of example 5 but it will just not play. I have a new PS3 slim with FW 3.1x and I run OS 10.5 on my old powerbook G4. I trying ffmpeg (built from source by myself and also using macports) and mencoder but none of them produce something usable. Would you already have a newer, better solution or should I just abandon the project and look for alternatives?
cheers
Ron
To convert MKV to MP4, DTS MKV to MP4 with subtitles, DTS MKV to AC3 with 5.1 channels, Aunsoft Blu-ay Video Converter Ultimate is best to keep subtitiles and video quality. With the support ofTrueHD, Eac3, DTS, DTS-HD in BD movie, you can select the subtitle and audio stream with the exact language you want.
DeleteI would just like to say thanks, for your instructions worked well for me.
ReplyDelete