Convert MKV to Xvid with Mencoder
I recently wanted to convert some of my 720p and 1080p Matroska Video (MKV) files to the Xvid format so that I can play them on my Xbox 360 (check out ushare). I really wanted to make sure that the video quality and Dolby Digital 5.1 audio would remain intact, and was pleased to get the job done with mencoder.
In the following example, I decided to use a single pass, fixed quantizer value of 4. The audio will simply be copied.
mencoder movie.mkv -channels 6 -ovc xvid -xvidencopts fixed_quant=4 \
-vf harddup -oac copy -o movie.avi
The Dolby Digital 5.1 (AC3) output was a major pain to figure out because by default, mencoder (and mplayer) only will select 2 audio channels. So increasing the value to 6 ensures you receive them all. Otherwise, you end up getting standard stereo out all channels.
There’s a ton of options that you can use, so just be sure to read the man pages for mencoder.
NOTE 1: This is not an exhaustive or definitive post on quality retention. This is just an easy way to re-encode a source video file to Xvid.
NOTE 2: MKV is only a container file format, meaning that you store audio and video tracks within an MKV file, as well as a number of other data types. e.g. Subtitles, Pictures, Fonts, etc. Many times, these video and audio tracks may already have been encoded with a codec supported by your media player. You could potentially extract the appropriate audio and video tracks with mkvextract (a component of the mkvtoolnix package), and recombine them into a container format supported by your platform. This is a great option because you would not have to re-encode, saving time and quality loss. I’ll update with more examples later.
Add A Comment