Windows Media Centre, Linux and .mkv files

Tuesday, February 10, 2009 Posted by Psyk 0 comments
I've been running Vista MCE for sometime now and while it's doing the job, I would've really liked to be running Mythdora... That'll be a project for another time.

In any case, I'm running ffdshow and the haali splitter. Haali is used to handle the MKV's (Matroska) and MP4's whereas ffdshow will pretty much handle any other format including Divx/XviD and anything else. As a result it's really all you need to prevent serious 'codec-hell' in Windows.

First and foremost, a lot of the credit needs to go to this UbuntuForums thread where the original poster walks through a process of ripping DVD's to MKV format.

Also, the following method is an alternative to my previous post in regards to encoding dvr-ms files into MP4 containers for PS3 compatible playback.

If you want to automate things and not really worry about tweaking or understanding the process (which will lend itself to allow you to tweak), then you can use something like avidemux.


However, I like tweaking and tinkering with the settings and understanding the process, so the manual method described in the Ubuntu link works for me.

One of the things I do, is use a different set of parameters for the H264/x264 encode in addition to using AAC encoded audio as opposed to ogg. Here is the 'to-mkv' profile entry in my ~/.mplayer/mencoder.conf
[to-mkv]
profile-desc=" Makes a x264 raw video stream for muxing into MKV"
lavdopts=threads=2
ovc=x264=yes
x264encopts=keyint_min=24:keyint=240:crf=18:qp_min=5:qp_max=51:qcomp=0.75:me=umh:subq=6:frameref=6:bframes=3:ip_factor=1.25:
pb_factor=1.33:deblock=-1,-1:nopsnr:b_pyramid=yes:brdo=yes:weight_b=yes:mixed_refs=yes:bime=yes:chroma_me=yes:partitions=all
:trellis=1:8x8dct=yes:threads=auto
oac=copy=yes
of=rawvideo=yes


The resulting mencoder command is:
$mencoder -profile to-mkv -vf scale=720:-10,harddup <video_source> -o <output_video>.264

The above command outputs only a raw h.264 video format with no audio. I'm asking it to convert "video_source" into a DVD scaled (720x576/480 etc.) h.264 "output_video".264. The ".264" extension helps identify it as a raw h.264 video and is of very good quality depending on your source. In my case they're usually TV recorded hi-def channels of 1920x1080 MPG format and AC3 audio.

Mux the .264 file into an MP4 container (the mkv utilities handles the mp4 format a little better):
$MP4Box -add output_video.264 output_video.mp4


If you haven't already separated the audio from the video, then you'll need to do that. Once done, normalize the audio file by doing:
$normalize audio.wav


Once you have separated and normalized the audio, encode to AAC format with the following:
$faac audio.wav -o audio.aac


Once you have the MP4 and AAC files you can use the mkv gui tools to mux them all into the Matroska (MKV) container. You can start the gui utility by running:
$mmg

...and that's all there is too it in creating mkv files in linux. I deliberately left out a lot of detail and only high-lighted some of the key points in the process in doing it as a lot of it is documented elsewhere.

Refer to the Ubuntuforums page for more detail: http://ubuntuforums.org/showthread.php?t=273635

Joining AVI files together

Sunday, February 01, 2009 Posted by Psyk 0 comments
Here's a simple way to join two AVI files together. The AVI's should be the same in regards to type (i.e. XvID/DivX, audio bitrate etc.):

$cat movie1.avi movie2.avi movie3.avi > movie_temp.avi
$mencoder -forceidx -ovc copy -oac copy movie_temp.avi -o movie_final.avi