Native Apps for Realz | Main | Drobo followup a few months later

October 19, 2007

MKV to MOV for big files

Please note, this blog has been archived and now lives at www.discretecosine.com

For most users, getting a matroska (MKV) file into Quicktime is as simple as installing the Perian codec. It makes things joyously simple. You can even do file->save as to rewrap your video as something else. Great!

It gets problematic when you have a really big (over 2gig) MKV file. QT will just crash! Oh no!

So, here's my workaround. Not for the faint of heart.

Start by getting the current CVS version of MPEG4IP. You'll need SDL and libtoolize to build it.

Also get mkvtoolnix and install that.

Extract the video and audio tracks from the mkv file using mkvextract:

mkvextract tracks <mkv filename> 1:part1.h264 2:part1.ac3

This will need to grind for a while, but eventually you'll have your demuxed tracks.

Next, you need to use mp4creator to wrap the H.264 elementary stream in a proper mp4 box. You'll probably get a warning about an invalid SEI message. Ignore that.

/usr/local/bin/mp4creator -create=part1.h264 -rate=29.97 "My Video.mp4"

Next, we need to add the audio. Unfortunately, mp4creator can't handle ac3 audio. You'll either need to convert the audio to AAC, and then use mp4creator to merge them, or use Quicktime Pro. I prefer the latter - open the ac3 file in QT, select all, copy, then open your mp4 and select add->add to movie.

Now, when you go to save, Quicktime will likely yell at you. You need to mark an in point a second into the video, and an outpoint a second from the end, and then select edit->trim. Then you can do "file->save as" and move on.

What a pain, hu?

Posted by at October 19, 2007 12:39 PM | Tutorials

Comments