Converting mkv to mp4

I was playing around with an .mkv video file and wanted to stream it to my playstation 3 and wasn’t really sure where to start.  I already have Mediatomb setup on my Fedora 11 box and it works great for avi, mpeg, mpeg2, mpeg4, divx, etc… but it didn’t natively have anything for mkv.  I found a couple sites that talked about how I could have mediatomb transcode the mkv down to mpeg2 or mpeg4, but I couldn’t get it to work quite right.  The best I was able to do was get it to play but it would pause (lag) for a second every 10 seconds or so (not ideal).  It may have been a limitation of my hardware or I just could of had some settings wrong.

My fix for this was to convert these mkv files to mpeg4 which seemed like a pretty easy thing to do with ffmpeg.  It involves finding the video track and audio track and writing those out to seperate files, flipping a hex bit, and merging them back together as your new format.  I was considering scripting it to make it easier but again hit up google first.  That is when I stumbled on this handy little python script called mkv2mp4.  This script does everything that you need.  First you will have to install a few things:

sudo yum install gpac gpac-devel gpac-libs mkvtoolnix mkvtoolnix-gui ffmpeg

You probably only need the gpac not the devel and libs, but I installed all of them to be sure.  You need the mkvtoolnix for the merge tool, and themkvtoolnix-gui because for some reason the mkvinfo program isn’t included in the Fedora package of mkvtoolnix.  Ffmpeg is used for the conversion.  After you convert the files you can play them directly on your PS3 or Xbox.  This works great for me and best of all (other than this is all free is)the conversion of a 750M mkv file to mp4 only took about 5 mins.  I was also told that Handbrake, a great open source video transcoder,  has a way to do this as well in a gui if that is your thing.


Be Sociable, Share!

Leave a Reply