Needed a simple script to copy video data for a fixed amount of time.
A shell script is available on ivtv driver page at Example script to schedule recordings, but wanted to do something without sending kill signals, so here's a script using the alarm signal.
Here's a perl script: timed-copy that uses an alarm signal instead of kill.
To use this, save the contents of the timed-copy link as text file, make it executable, and fix the perl path in line 1 if needed, and it is then ready to run.
I use this for capturing PVR-150 MPEG2 encoded video, by running something like this:
and scheduling this with the
timed-copy -v -m 30 < /dev/video0 > `date +%b%d-%H%M`.mpg
at command, for example:
at -v 1:30AM Sep 14
which will end up creating a file named
Simple! Beats installing large, complex packages to do simple recordings.
timed-copy -h to get help on all arguments, use
-v to get verbose messages, and
-v -v to get debug messages also.
Version 1.2 added a
--clock option to use elapsed wall clock instead of alarm(), if needed.
Version 1.3 fixed the problem with alarm() - Time::HiRes has issues with alarm times, if the conversion to microseconds is greater than 2^32. Fix is to eliminate use of Time::HiRes, since the higher time resolution is not needed for this script, and a resolution in seconds is fine. Script now uses the default alarm() which works fine. So, the
--clock option should no longer be needed.
Tested on a Fedora FC5 Linux system.