Grabbing movies from TV

From time to time I grab something from TV to watch it later. Each time I had to re-discover proper MEncoder params and finally decided to write about it on site — maybe someone other will find it interesting.

Machine is simple PC desktop powered by AthlonXP 2200+ CPU (1.8GHz) and Pixelview TV tuner (card=70 in bttv) which sound output is connected via loop-cable to Line-In of onboard via82xx soundcard (ALSA driven) — all under control of Debian ‘sid’ running Linux 2.6 (2.6.16-ck1 now). For grabbing I use MEncoder (own CVS build).

First thing to do is to pick a channel — I run tvtime and quit after select proper one. Then mixer (I use KMix) is needed: turn on capturing of Line-In (can mute it too so it will not bother you during grabbing). After this you should be ready to grab videos.

Now MEncoder has to be started (all in one line):

 mencoder tv:// -o tv2.avi -ovc lavc -oac mp3lame \
 -tv driver=v4l2:width=640:height=480:alsa=1:\
       immediatemode=0:forceaudio:forcechan=1 \
 -lavcopts vcodec=mpeg4

This will tell that we want DivX with MP3 Audio — on my machine this encoding takes ~50% CPU. Before I used M-JPEG but was taking too much disc space.