MKV to MP4 for playback on PS3 – GNU/Linux
This is just an updated version of other guides I found on the net.
You will need these programs to do the conversion:
– mkvtoolsnix
– gpac
– hexedit
– ffmpeg
(If you are running Slackware these packages can be found in SlackBuilds.org and Slacky.eu)
1- Extracting the video:
First of all you need to know two things: in which track is the video and whats it’s fps:
$ mkvmerge -i The_Matrix.mkv Track ID 1: video (V_MPEG4/ISO/AVC)
the video is in the track #1
$ mkvinfo -i The_Matrix.mkv | less
and the first fps result i get is 23.976 (which is the most common). We will be needing this later.
With this information you can now extract the video from the MKV container:
$ mkvextract tracks The_Matrix.mkv 1:video.h264
2- Extracting and re-encoding the audio:
I don’t know why the audio needs to be re-encoded and I don’t care to know(Wikipedia might know), I just know that this step is necessary:
$ ffmepg -i The_Matrix.mkv -vn -acodec aac -ac 2 audio.aac
If ffmepg complains something about aac, just add this parameter to the command:
$ ffmepg -i The_Matrix.mkv -strict experimental -vn -acodec aac -ac 2 audio.aac
3- Hexediting the video:
With hexedit open the video.h264 file you generated, and on the first line, change the following string from:
67 64 00 33
to
67 64 00 29
4- Creating the MP4 container:
$ MP4Box -add video.h264 -add audio.aac -fps 23.976 The_Matrix.mp4
if you get an error like «I/O error» than it’s because you don’t have enough space in /tmp, this can be fixed by specifying another /tmp catalog, like the $HOME partition:
$ MP4Box -add video.h264 -add audio.aac -fps 23.976 The_Matrix.mp4 -tmp $HOME
Source:
http://www.swedroid.se/forum/45653-mkv-container-till-mp4-container-i-linux-x264.html
http://oddmanout.wordpress.com/2008/01/26/converting-an-mkv-h264-file-to-ps3-mp4-without-re-encoding-on-mac-os-x
ei pero que neto es este blog!