MKV Sucks
Like its friends AVI, OGM and MP4, MKV is a Media Container. It can contain multiple video tracks (All using different video CODECS (XVID/DIVX, X264/AVC etc.)) and multiple audio tracks (All using different audio CODECS (MP3, AAC, AC3 etc.)). Many video publishers online choose to publish video in .MKV format because the video tools are well developed. MKV has a dark side though… It's Slower, Choppy-er, Bigger and downright annoying for anything high-def.
After scanning the forums I have found (FOR UBUNTU/LINUX) a quick conversion from MKV to MP4 that unlike all the other forums does not require RECODING the video.
Credit goes to ubuntuforums.org's hansa56. (Thanks hansa56, I just didn't think that it should be left in a forum)
Assume we have a file "File.mkv" that has these two tracks
- Audio Track encoded as ac3
- Video Track encoded as h264/AVC
First install the needed applications
$ sudo apt-get install mkvtoolnix gpac hexedit mplayer
And download the neroAacEnc from http://www.nero.com/eng/nero-aac-codec.html Unpack to the a linux directory, chmod +x on the neroaacenc file and copy that file to the same directory as your video
Then you have to find out what Tracks have been encoded into the file
$ mkvinfo-text File.mkv
Then using that info we can tell mkvextract to DEMUX the video from the audio
$ mkvextract tracks File.mkv 1:audio.ac3 2:video.h264
Apparently you have to change one byte inside the video.h264 file
$ hexedit video.h264
Move your cursor in the first line to where they bytes read "67 64 00 33" and change the "33" to "29" (Ctrl-s to save, Ctrl-z to exit)
To convert the audio to AAC format
$ mkfifo audiodump.wav
$ ./neroAacEnc -ignorelength -q 0.20 -if audiodump.wav -of audio.m4a & mplayer audio.ac3 -vc null -vo null -ao pcm:fast
Finally Re-MUX the video with the audio
$ MP4Box -add video.h264 -add audio.m4a File.mp4
All with no conversions… just a bunch of remuxing…