mencoding malcolm

Malcolm in the Middle is one of my favorite TV shows evah. It’s great stuff. I watched about twelve episodes this weekend. It was great.

Anyway, since only season one is on DVD, I’m making my own set just for me. I’ve already got about 100 or so of the 151 episodes recorded using mythtv. Well, first of all I strip out the commercials manually with avidemux2, which actually doesn’t take very long. Then I re-encode it to MPEG2 with some special settings so it can be burned onto a DVD.

Newer versions of mplayer (I forgot where they started with this, since I run the SVN development version) have a feature called “profiles” which saves me a ton of time, especially with encoding. Basically what you do is take a set of options and stick it in a profile in your mencoder config file. Then, instead of passing 500 arguments to the command line, you just do something like this:

mencoder mitm_002_red_dress.avi -o mitm_002_red_dress.mpg -profile dvd

Isn’t that much simpler? Here’s my dvd profile settings:

[dvd]
profile-desc=”NTSC DVD”
oac=lavc=1
ovc=lavc=1
of=mpeg=1
mpegopts=format=dvd
vf=scale=720:480,harddup
srate=48000
af=lavcresample=48000
lavcopts=vcodec=mpeg2video:vrc_buf_size=1835:vrc_maxrate=9800:vbitrate=2200:keyint=18:acodec=ac3:abitrate=192:aspect=4/3
ofps=30000/1001

Just drop that in ~/.mplayer/mencoder.conf and you’re good to go.

The only real difference between mine and the mencoder docs is I changed the video bitrate to 2200 instead of 5000. And if you wanted to save a little more space, you could change the acodec to mp2 instead of ac3.

I hate having to type even all that profile stuff in though, so I made it even simpler and made a tiny bash script that does the same thing for me:

#!/bin/sh
F=`basename $1 .avi`

MPG=${F}.mpg

if [[ ! -f ${MPG} ]]; then
mencoder $1 -o $MPG -profile dvd
fi

The nice thing about it is it checks to see if the file exists first, and won’t overwrite it. Now I just run avi2mpg mitm_002_red_dress.avi, come back in a few minutes, and I’m ready to go. Then I just create the DVD filesystem and burn em, and I’m all done. They look great, too.

And I have no idea why I’m reencoding one that’s already on season one. Whoops.

Leave a Reply