I want to record my favorite dvb-t channels and I found in docs the way to do it:
mplayer -dumpfile r1.ts -dumpstream dvb://CHANNEL -endpos 01:01:00
You need to use the parameter -endpos. Check out the mplayer documentation. For example the following records for 1 hour (well, 3600 seconds to be precise):
mencoder -o r1.avi -endpos 3600 -ovc xvid -xvidencopts bitrate=800 -oac mp3lame -lameopts cbr:br=128 -pp=ci dvb://CHANNEL
I suspect the reason why the mencoder line does not work via cron or at (assuming it works if you use it straight from the command line) is that you have not specified a destination directory e.g:
mencoder -o /path/to/dir/r1.avi -ovc xvid -xvidencopts bitrate=800 -oac mp3lame -lameopts cbr:br=128 -pp=ci dvb://CHANNEL
FWIW, a brain dump… I use the following script:
#!/bin/bash mencoder dvb://"$1" -idx -oac copy -ovc copy -endpos "$2" -o "$3"/"$1-`date +'%F %T'`".avi > /tmp/"$1".log &2>1
Parameter 1 is the channel
Parameter 2 is the endpos
Parameter 3 is the directory to record into – the file name is the is CHANNEL-DATE.
It also creates a log file (/tmp/CHANNEL.log) for debugging purposes.
No transcoding takes place (-oac and -ovc copy) so there is minimal CPU usage. If I want to keep the recording I transcode afterwards – if transcoding cannot keep up with the broadcast the recording may fail.
For one off recordings at a specific time, where script = whatever the script is called):
echo “script [channel] [endpos] [dir]” | at [timespec]