Converting an MKV (h264) File to PS3 MP4 Without Re-encoding on Mac OS X

I searched a *long* time on the net trying to find out how to convert a HD mkv file to an MP4 file for play on the PS3 without re-encoding on Mac OS X. Couldn’t find anything that didn’t cost any money which was rather irritating; lots of question, not really any answers.

But, what I did find was how to do it on Linux. Which was great because through MacPorts, we on OS X have access to many of the same tools. Unfortunately, I had to spend a significant amount of time to patch work the different tutorials and tweek them to work on OS X. So, hopefully this will save some other poor soul some frustration.

Disclaimer: Now, I’m not going to be citing my sources. If you want to see what I saw, just Google and you’ll see it. This isn’t to slight anyone, but because there are too many, over a good chunk of time, and it was a fair bit long ago, I actually can’t. I’m just mentioning this because I don’t want to take credit for what others figured out. My contributions were figuring out that the hexedit trick worked with mp4creator and which tools were the most appropriate to get the needed jobs done on OS X… after a lot of experimentation/time/frustration/etc. But, without further ado…

To do the below, you’ll obviously need some tools installed. They can be easily installed through MacPorts. So, if you haven’t already, go install it now.

Now that that’s done, here’s what to install through MacPorts:


Now the above can be installed with the default settings. But, we still need to install ffmpeg which needs some options set. I personally suggest installing it with all options. For convenience here’s the command as of this writing:

sudo port install ffmpeg +a52 +faac +faad +gpl +lame +libogg +postproc +theora +vorbis +x264 +xvid

That will probably take awhile…

There is a possibility (I’m not going to uninstall everything and re-install just to check this) that one of the above might require you to force install a package because two ports want to install a file of the same name. I did it have have yet to suffer for it. Though the reader should make up his/her own mind on that one if it happens.

Now that we have the needed tools installed, we can move onto getting at that file.

First we get info about the file:

mkvinfo file.mkv

Here we’re looking for a couple things:

1) What track is the video tracks
2) What is the framerate of the video track
3) What format the video track is in

To see if the video is encoded in the proper format, look for “Codec ID: V_MPEG4/ISO/AVC”. To get the framerate, in my version I the item is called “Default duration” and you can scan right of that to get the fps. We now extract the track:

mkvextract tracks file.mkv TrackNumber:video.h264

Next we get the audio. The PS3 has limited audio support for the MP4 container. But, because we’ll have to convert the audio anyway (yes, I know I said no re-encoding, but audio “usually” comes in ac3 format and audio takes zero time to convert compared to video anyway), we just do that in one step:

ffmpeg -i file.mkv -vn -acodec aac -ac 2 audio.aac

Now that we have the audio in a PS3 compatible format we need to get the video in one as well. Most video comes in 5.1 profile which the PS3 doesn’t understand. Luckily it’s very easy to change this. We open video.h264 in hexedit and notice on the first line:

67 4D 40 33

Which we change to:

67 4D 40 29

NOTE: The Sha has noted that (s)he ran into a different number combination than the above and upon closer inspection I have run into a couple new ones as well. The good news in this is that the 33 remains the same and is the one that you want to change. What you’re looking for in hexedit, is the 2nd distinct column grouping of numbers. The 33 will be on the top line and is the right most number in that 2nd grouping.

We then make a MP4 file with the video that we extracted specifying the video’s framerate:

mp4creator -create=video.h264 -rate=videoFramerate file.mp4

We also need a hint track in there for the video:

mp4creator -hint=1 file.mp4

To get the audio in, we do:

mp4creator -c audio.aac -interleave -optimize file.mp4

Next comes getting that file to the PS3 itself. Though there are several options available, I use MediaTomb. I just got the Portfile ready to submit and when doing so, found out that it’s already in MacPorts. So, just:

sudo port install mediatomb

That one command will install mediatomb and all its dependencies. Happy viewing!

For large file support, see my addendum.

For a GUI program that does specifically the tutorial written above, see here.


56 Responses to “Converting an MKV (h264) File to PS3 MP4 Without Re-encoding on Mac OS X”

  1. the sha Says:

    Thanks for the tutorial, I’m going to give it a quick try, and see if I can replicate it on linux since most the tools are the same, but was wondering what mime type do you have set in your MediaTomb config file to recognize mp4’s?

  2. Odd Man Out Says:

    No problem. But, I believe that all of the tools are available on Linux. So, that shouldn’t be a problem. Also, if any of the above is ambiguous, please let me know so I can try to improve it.

    Regarding the mime-type, I haven’t touched a thing from the default config aside from adding in some unrelated transcoding stuff. MediaTomb seems to handle MP4’s just fine on its own (I believe it uses libmagic or libextractor to do this).

    But, if you have any problems with MediaTomb, that community is very helpful. There forums can be located through there sourceforge page:

  3. the sha Says:

    Thanks again for the tutorial,

    I actually tried it out, but had problems with the MP4 wrapper app, but was able to use MP4Box instead. The ffmpeg tip saved me tons of time, and I was able to create a simple script that now automatically remux’s on the fly, which after some testing will share. Only other difference I found is my videos is that they were using the hex code of 67 40 00 33 instead of what you posted above and now everything works great.

  4. the sha Says:

    Also, since I’m using a slightly older version of mediatomb and not the svn I had to add a video/mp4 mimetype to get the ps3 to recognize and play the files..

  5. Odd Man Out Says:

    Thanks! I’ve updated the guide to accommodate this new info.

  6. Raoul Says:

    the command “ffmpeg -i file.mkv -sameq -vn -acodec aac -ac 2 audio.aac” didn’t work for me: Unknown encoder ‘aac’.
    I had to use the option “-acodec libfaac”

  7. Odd Man Out Says:

    Different platforms (and/or ffmpeg versions?), for some unknown reason, require different codec names. Current, Mac OS X ffmpeg installed through MacPorts *as is specified in the guide* requires “-acodec aac”.

  8. Tomislav Says:

    Any way to script this?

  9. Odd Man Out Says:

    Yes. But, I have no idea if/when I’ll get around to that.

  10. Gadget Says:

    Hi, I have followed your guide which is great but I am getting error with mp4creator “Error decoding sei message” and I was just wondering if this is normal or am I doing something wrong??

  11. Gadget Says:

    Hi, again carried on with the conversion I found that I can play the video.mp4 file on my PS3 fine but as soon as I add the audio the mp4 file my PS3 says “Corrupt Data”. I can play the file fine in Quicktime but when I show movie inspector the format show as VC Coding

  12. Odd Man Out Says:


    I get that mp4creator error as well. Doesn’t seem to effect anything.

    On the video.mp4 file, could you please do:

    mp4creator -list video.mp4

    And post that. It’ll let us know exactly what tracks/encodings are in the file.

  13. Gadget Says:

    I run the command and this what was produced.

    1 video H264 Main@4.1, 5211.086 secs, 6564 kbps, 1280×528 @23.976000 fps
    2 audio MPEG-4 AAC LC, 5211.008 secs, 61 kbps, 48000 Hz

    I also found that when I added the “hint” to the video the PS3 would play the video.

  14. Gadget Says:

    I have been doing some more research on the Internet and think it maybe to with the size of the mkv I am trying to convert it is 4.37GB ??

  15. Odd Man Out Says:

    I believe that the 4G file size limit is only relevant to VOB files.

    But, not having the hint track would mess up streaming the video (so the docs say). When you played the non-hint version, were you streaming it? If not, you just stumbled on another peculiarity of the PS3.

  16. Gadget Says:

    I’m not trying to stream it, but play it directly on the PS3. Do you have any ideas/settings/command lines on re-encode the video to make it smaller.

  17. Odd Man Out Says:

    So, the PS3 requires a hint track even though it isn’t technically required by spec. Interesting.

    I haven’t played around with the other supported a/v formats much. But, what I use for non-high-def stuff is DVD compatible output through MediaTomb’s transcoding features. The weird thing is that the output plays streaming from MediaTomb and once it’s copied over through MediaTomb. But, if I transcode on my computer and then try to view by either copying over or streaming that file, it doesn’t work. Just letting you know about the limitations. There are also other better codecs supported by the PS3 that you should check out elsewhere.

    This is the sh script I use with MediaTomb’s transcoding feature:



    exec ffmpeg -i “${INPUT}” -f dvd -sameq -ac 2 – >”${OUTPUT}”

    I don’t know if the file size will get smaller though. Just haven’t paid attention to that. At any rate, that’s something to start with. Hope that helps.

  18. Aerodiver Says:

    Fantastic work Odd Man. Just a few suggestions for ffmpeg options.

    Still playing around with settings myself, but notice the default settings used by ffmpeg are terrible audio quality. It seems to default to 64kbps.

    I use the following:
    ffmpeg -i -sameq -vn -acodec libfaac -ac 2 -ar 48000 -ab 320k

    Not sure -sameq actually does anything for us, the man page suggests this is a video option.

    Note: my ffmpeg also wants “libfaac”, and that was a fresh install today.

    I get the following errors trying to add a hint track, but it doesn’t seem to stop the movie from playing on the PS3 via Mediatomb:
    MP4ERROR: MP4File::FindIntegerProperty: no such property – moov.trak[0].mdia.minf.stbl.stsd.*.esds.decConfigDescr.objectTypeId
    MP4ERROR: MP4File::FindIntegerProperty: no such property – moov.trak[1].mdia.minf.stbl.stsd.*.esds.decConfigDescr.objectTypeId

  19. Aerodiver Says:

    Previous post has lost the file names, thanks to some tag parsing.

    command line should be:
    ffmpeg -i input-file.mkv -sameq -vn -acodec libfaac -ac2 -ar 48000 -ab 320k output-audio.aac

  20. Odd Man Out Says:


    I get those errors to with no negative results.

    What the bit rate for the audio will be on that command line will strongly depend on what the bit rate is on the input. For instance, specifying 320k is not going to help if the input is only 64k. Similarly for the sampling frequency. Though that -sameq is indeed for video only.

    I’ll update the command to reflect that now, and the next time I convert a mkv I’ll add in the bit about the bit rate and sampling frequency. Thanks for pointing that out 🙂

    Was your fresh install on OSX? Because I just tried to upgrade mine, but it gave me errors on the install.

  21. Aerodiver Says:

    Yes was a fresh install on Leopard. Had problems with ffmpeg install. Currently an issue with portfile versions apparently. Googled and found you need to bump the ffmpeg portfile svn tag to 12276, see last post in this ticket:

  22. Cobiwan Says:

    Can I set a display width and height while creating the mp4 file?

  23. gambit Says:

    when i do the hint step, it seems to ruin my mp4 file. i can’t play back the video file in VLC any more.

    also, after extracting the AAC file from the MKV file, should i be able to play it back in quicktime or VLC? the audio extraction process seemed to complete fine, but i get no playback from the output AAC file.

  24. gambit Says:

    i should add the audio from the MKV file is DTS if that makes a difference. i was able to successfully extract the audio track as AC3, but apparently no luck with ACC.

  25. phyber2004 Says:


    Thank you so much for taking the time to put this together. After spending about a month banging my head against a wall on this particular subject, I was almost there – the only thing remaining was to change the AVC level from 5.1 to 4.1.

    Is anyone aware of a command-line utility which runs on a Mac that will take care of the AVC level conversion? I’m actually working to create a finder automation script which will accomplish all of this for you with a simple right-click.

    PC users have the luxury of h264info – I wonder, is there something out there for Mac?

  26. Odd Man Out Says:

    Sorry for the late replies. RL issues.


    Still haven’t gotten around to it. Probably within the next week.


    Not by this method. Look up methods of transcoding and you’ll find such thing. FFmpeg is capable of this. Though any method will take hours (at least) to complete the operation which is why conversion without transcoding is so sought after.


    This tutorial is about getting an a/v file to play on a PS3 (can it?). Though it still should be able to be played in VLC. Perhaps you have one of those “special” files that don’t work (I’ve had this once before). Could be a codec problem as well. Not really sure without more info.

    I don’t mean to side step this issue. But, blog comments aren’t exactly the best place to debug a problem. I’ve found that the people at are friendly and helpful. On your first post, I’d recommend posting the output of mkvinfo (of course removing info identifying what you have).


    Glad I could help 🙂

    mp4creator has a switch to force a level. But, I haven’t had any luck using it for lack of documentation and lack of time to go through the code and figure out acceptable values for that switch myself. Failing this, one could make a simple Python (it’s included in base OS X) script to do the job. It is, after all, just flipping a couple bytes in the video.h264 file. But again, I don’t have time to do that myself.

  27. macshodan Says:

    Thanks oddmanout, great tutorial!
    By the way I’m having 2 problems: first if the resulting file is greater than 4Gb mp4creator give an error and the resulting file will be unplayable. I’ve tried smaller files, like HD TV Shows for example and they work fine.
    Second, i’m trying to convert the audio to AAC 6 channels instead of stereo using ffmpeg, but the resulting audio stream has mixed channles mapping, no matter how much I try. The center speaker is mapped on the the right one, and so on for the others. Looks like is a problem with ffmpeg, anyone has tried it? Because for now I have to use Quicktime to create an AAC 6 channel file, but the process is very long and boring, first I have to export the audio track to a aif sound, then convert it into mov with aac 6 channel, and then export to mp4 with passthrough. 😦

  28. Odd Man Out Says:

    You’re welcome.

    Problem #1: Never had that myself. But, if there is a problem with mp4creator, best contact them.

    Problem #2: See 1. Also, I don’t think that the PS3 can handle 6 channels. Or at least I’ve not seen any reports stating that. Are you saying that 6 ch AAC works on the PS3?

  29. John Says:

    I tried out your latest method on [ edit for legal reasons ].

    Now to the problem. The resulting mp4 files plays on my PS3 but every few seconds there is a pause in the file and then it continues. It’s kind of like the file is stuttering. The funny thing is that I tried out playing the aac file on it’s own as well as the video only mp4 file (before we combine the audio to it) and both times there were no pauses or stuttering of any kind. However, when the 2 tracks are merged into the mp4 file, the result is this disturbing stutter.

    Can you please help me with this since my searches on the net have yet to yield any results.

    Thanks and great work.

  30. komp Says:

    For Linux owners (this is tailored to GENTOO but thats only the packages) I have put together this script.
    Read the top comments and get the software you need install 1st.
    copy the text below to a file somewhere on your linux box. chmod 755 the file so you can execute it.

    This does a 1.2Gb home video in 17 mins on a P4 3gz

    syntax is ./ps3convert filename.mkv

    [ Edit to remove script. Post scripts as files elsewhere and link to them. That is assuming that it runs on OS X as well (please respect the blog topic). ]

  31. TeeSeeJay Says:

    Hey guys, wanted to confirm that the PS3 does support 6-channel AAC in an MP4 file. You can download HD Trailers from apple in H264/AAC5.1, use QTPro to move it from MOV to MP4 with passthrough A/V, and the resulting file plays just fine on the PS3. I watched the Happening 1080p trailer this way.

  32. macshodan Says:

    Sorry for the long time taken in the delay.

    Yes, the ps3 can handle 6 aac channles, if it’s attached by HDMI to a capable receiver (like the onkyo sr-605), best thing is that otherwise it will demux to 2 channels stereo on the fly! I’ve tested it myself, and I can have full 6 channels in aac through the ps3! 😀

    Right now I can accomplish that by opening the original mkv in quicktime with Perian installed, export the movie to sound to aiff, this will create an aiff soundfile with 5.1 channels. After, open in quicktime the aiff file, export to quicktime movie, selecting AAC 5.1 in the audio decoding options. After that, open the resulting mov file in quicktime, export to mp4 with passthrough option, extract the audio track from the mp4 with mp4creator in an .aac file.
    At last, mux the aac file to the mp4 file created with mp4creator.

    I still can’t handle files larger than 4Gb with mp4creator, but it’s better than the bug with mp4box which can handle at least files under 1.4 gb.

  33. Odd Man Out Says:


    It could be many things. The PS3 does have limitations with video playback. I think that it’s around a 20,000 bit-rate, though that should be checked. If your video is just below that then adding in the audio could put it into problem territory and thus the stuttering.

    If you are streaming the file, then it might be a network issue.

    It might also be errors in the a/v data.

    Asking the people at would probably be more fruitful.


    Thanks for the report! I’ve tried using ffmpeg for the same end, but had some issues. Not sure if that was because of the specific file(s) or not though. Will try again, but ffmpeg doesn’t seem to have much support for > 2 channel audio.

  34. Faye Pearson Says:

    I found this so useful, I wrote a program to automate the patching. Thanks for the guide, I hope people find the program useful. Feedback please!


  35. Faye Pearson Says:

    Oops, forgot to put that it operates on .mp4 files, so can be used with the output of Quicktime Pro too.

  36. Vadym Says:

    Thank you for the info. I’ve put together a little script that assumes source video in mkv is mp4.

    If anyone knows how could subtitles be muxed, share this knowledge. Since 2.30 supports DIvX subtitles, and DIvX is also a container, there should be the way …

    [ Edit to remove script. See above comment about posting inline scripts. ]

  37. Gasz2 Says:

    I saw that an option on mp4creator could be used to create an 4.1 profile MP4 file.

    mp4creator -create=video.h264 -rate=23.98 -mpeg4-video-profile=4.1 file.mp4

    You does not need hexedit to change values on video.h264

    Thanks for your posts. Help me a lot.

  38. Odd Man Out Says:

    I have tested -mpeg4-video-profile=4.1 on a file I have and it did not work. I still ended up 5.1 profile mp4.

  39. Keppie Says:

    I got all this working (except mediatomb, which has been compiling for hours on my crappy core solo mac mini), but ran into the mp4creator 4GB limit problem mentioned above. Is this the error everyone else got:

    [hostname:/Volumes/Non-Bootables] user% sudo mp4creator -create=video.h264 -rate=23.98 file.mp4
    Error decoding sei message
    Assertion failed: ((m_size <= (u_int64_t)0xFFFFFFFF)), function FinishWrite, file mp4atom.cpp, line 738.
    [hostname:/Volumes/Non-Bootables] user%

    I was just wondering won’t ffmpeg mux the component files? (And hopefully not have a 4GB limit?)

    I found this command elsewhere to make a VOB container for the file:

    ffmpeg -r 23.976 -f h264 -i movie.h264 -f ac3 -i movie.ac3 -vcodec copy -acodec copy -f vob movie.vob

    wondering if you can simply change -f vob to -f mp4? Probably not but if the VOB file works do we care?

  40. Keppie Says:

    Boy was that easy…

    forget ffmpegx, if you use the option -use64bits with mp4creator, everything works, even on my 7.29GB file

  41. Keppie Says:

    or not. -use64bits creates a playable video, but when you try to add the hint, it fails and makes it unusable. If you start all over again and skip the hint, get back to the same video only file, and try to add audio, it also fails…

    And after 4 hours of compiling and mediatomb and it’s 59 dependencies, it fails (using current mediatomb-0.11.0) on:


    File ‘/sw/src/’ not found!
    make[1]: *** [language.doc] Error 1
    make: *** [install_docs] Error 2
    ### execution of make failed, exit code 2

    I’ve got a headache

  42. Odd Man Out Says:


    The last several times that I’ve looked at Fink, it pretty much seems abandoned. Which is why I personally use MacPorts and use it in this tutorial.

    I have also updated the tutorial a bit. Mediatomb is now in MacPorts and the command is listed above.

  43. Gaston Says:

    Hi. I’m desperate to know how to mux subtitles inside mp4 container in order to play correctly on my PS3.

    I’ve successfully demux a MKV file in its three main tracks: AVC video, AAC audio, and ASS subtitle. The ASS file is not recognized in most of the apps I’ve tried (Mac & WinXP) so I’ve being trying converting to SRT which is recognized but without succeed in playing the sub in the PS3.

    I’ll appreciate any tip to make this done. Thanks.

  44. Odd Man Out Says:


    Just googling ‘mp4creator subtitle’ gave a few hits that may be helpful and has many helpful people there that may have already solved this. Though I haven’t checked that out myself.

    If you can’t figure out how to do this on the fly, you might want to consider recoding the subtitles right into the video. I’m not sure exactly how to do this (ffmpeg probably has options along these lines), but I’ve come across many files that have the subtitles planted right in them. So, it is technically possible. Of course this will take some time, perhaps prohibitive, but it is an option.

  45. Large MKV (h264) File to PS3 MP4 « Just Another Odd Man Out Says:

    […] MKV (h264) File to PS3 MP4 This is pretty much an addendum to my previous tutorial on the […]

  46. Odd Man Out Says:

    I’m all for free speech, but I’m also against hijacking a blog posting(s comments) for someone else’s own end. Especially when it’s a *very* limited “solution.” That’s what *their* blog is for (or forum postings when it’s on topic). So, a little cleansing for the sake of this blog entry’s karma and to get rid of the hijacking.

  47. Andy Says:

    This is a great tutorial. I noticed a lot of people saying they’ve written scripts for this. Can anyone email their automated script at

  48. Odd Man Out Says:

    I noticed this on my stats page as an incoming link:

    And if you click on Faye Pearson’s name above, you would end up here:

    Haven’t tried either, but that should get you started. There’s also which would be able to provide more help.

  49. Andy Says:

    Thanks! The one from technogrip was just what I was looking for!

  50. Andy Says:

    Actually, as a followup to my last post, I am noticing some syncing issues using the script at technogrip. The audio is just very slightly off from the video (but enough to drive me crazy). I did not notice this issue when I was using macshodan’s method to extract the audio (using quicktime pro). Anyone have any suggestions?

  51. Odd Man Out Says:

    Follow the manual method or ask on

  52. Hansen Says:

    The one from techogrip is not quite OK, since it doesn’t check track types.. if e.g. track 1 is audio and not video…

  53. Hansen Says:

    I got everything to work – also created a script that processes files for me – but when a mkv has DTS track, the sound gets static – is there a way around this?

  54. Odd Man Out Says:

    I haven’t had problems with that. Ask on

  55. MKV to MP4 for PS3 with dual-audio (2ch AAC + 6ch AC3) Says:

    […] next step, however, is where I’m at a loss on how to proceed. In the guide(s) I used (found here and here), I’ve been instructed to use HEXEDIT to change some numbers in the h.264 video file […]

  56. My Personal Diary » MKV to VOB on PS3 Says:

    […] Converting an MKV (h264) File to PS3 MP4 Without Re-encoding on Mac OS X […]

Comments are closed.

%d bloggers like this: