My personal Linux TV recording method:-

After many months researching lot`s of ways to record TV using Linux, I finally reached a point close to perfection, this page`s purpose is to share the method with others and is updated as and when it`s improved.

Goals

  1. Stability (Work in Linux should not compromise recording)
  2. Simplicity
  3. Rock solid A/V sync
  4. Timed recording
  5. Recorded files both compatible with Linux and Windows
  6. Ability to simultaneously record and watch TV
  7. Time Shifting

My system (should be adaptable to yours)

You`ll need the following software packages:-

Basic Recording

mencoder tv:// -tv driver=v4l:input=1:width=384:height=288:volume=80 -vop eq2=1.4 -of avi -ovc lavc -lavcopts vcodec=msmpeg4v2:vbitrate=1200 -oac lavc -lavcopts acodec=mp3:abitrate=96 -o record.avi -endpos 999:00

Note -vop eq2=1.3 makes the recording slightly brighter to compensate for the incorrect gamma on my TV card, if your recordings are too bright, remove this part. input=1 tells mencoder to record the composite input of the TV card, you may need to change this.

Now try some recording :) you can watch the live recording as it`s being recorded by launching another video player (I use Totem) and loading record.avi

record.avi should be a nice Microsoft Mpeg4 video with mp3 audio at 96kbits. No further processing is necessary.

Enhanced Recording

The next recording method requires a lot more CPU power, but can produce around the same quality video in a considerably smaller filesize. Video Bitrate becomes variable with heavy quantizing and is compensated for with noise reduction.

mencoder tv:// -tv driver=v4l2:input=1:width=384:height=288:volume=80 -vf hqdn3d,eq2=1.2,crop=380:288:4:0 -of avi -ovc lavc -lavcopts vcodec=msmpeg4v2:vhq=4 fixed_quant=12 -oac lavc -lavcopts acodec=mp3:abitrate=96 -o record.avi -endpos 999:00

The above example should be fine, but it`s best to play around with the parameters to suit your needs, when your happy with the results save the command as a text file called `rec` (See Timed Recording below).

Basic Timed Recording

As an example, let`s say we want to record at 3pm today for 1 hour, edit the file `rec` so that -endpos 999:0 is -endpos 60:00, save it, then launch a terminal console and type :-

at 15:00 today -f rec

a job number will be assigned, and at 3pm it will begin recording for 1 hour, neat eh?

Time Shifting

Time shifting is great! it enables you to pause/rewind and forward live TV, the longer you pause, the more you can fast forward (Skipping commercial breaks for example).

Using the described methods above you will already have time shifting capabilities, but it`s quite annoying having to cut and paste scripts, so let`s make some nice icons.

First create the file timeshift.sh containing the following commands :-

mencoder tv:// -tv driver=v4l:input=1:width=384:height=288:volume=80 -vop eq2=1.4 -of avi -ovc lavc -lavcopts vcodec=msmpeg4v2:vbitrate=700 -oac lavc -lavcopts acodec=mp3:abitrate=96 -o timeshift.avi -endpos 999:00&
totem timeshift.avi&

We are simultaneously launching totem & mencoder (the movie player, you could use mplayer or kaffiene too)

Save timeshift.sh and test it from the console using `sh timeshift.sh`. Mencoder should always initialize before totem begins playback, if it doesn't, then you`ll need to insert a pause after mencoder (before totem)

When your happy timeshift.sh performs well, make a desktop icon that runs the script.

You`ll also need to make another icon to kill mencoder, just link an icon to the command `killall mencoder`

:)

Regards,

Mike

Last updated October 24, 2005