X
Tech

Scheduled video capturing on GNU/Linux made easy

Do you ever have the need to capture video based on a schedule? I've written before about how I use Kino to capture video on my Linux workstation.
Written by Chris Clay Clay, Contributor

Do you ever have the need to capture video based on a schedule? I've written before about how I use Kino to capture video on my Linux workstation. It is a very fast, powerful, and simple to use video capturing and editing application.

But what if you want to capture video when you are not around? Recently I wanted to capture video from my external TV tuner and schedule it when I was away. Well, it's quite easy. Since I use an external TV tuner, it has an analog output that I hook to my capture device (which happens to be a Canopus ADVC-50 card, connected by firewire). Linux sees the capture card as a DV (digital video) device.

The magic is done by the utility called "dvgrab". And, as most GNU/Linux utilities come, dvgrab is simple yet provides a lot of functionality. dvgrab can capture video from any DV firewire device, provided that the Linux kernel sees it. As usual, I read the man pages for dvgrab, and found that it has a lot more options than I thought. It can capture DV video and output it not only as a raw DV file, but also supports other formats like AVI, Mpeg2, Quicktime, and more. You can specify the amount you want it to capture for until it stops, either by specifying the duration in time or frames. There are more options, just check out the man pages for yourself to read more about them.

So, in this case, all we need to do is schedule a task to run and use dvgrab to get the video. I use the Gnome desktop, so I prefer to use the "Scheduled Tasks" program which is basically a frontend for Cron and At (two scheduling applications commonly used on Linux/Unix systems). The Scheduled Tasks program is actually called "Gnome Schedule", and the package is called "gnome-schedule" on Fedora. What I particularly like about Gnome Schedule (or Scheduled Tasks) is that it is very simple to use. And, it has a nice templates feature where you can set up schedule templates, and use them to create tasks with a couple of clicks. This is great so that you don't have to keep track or memorize the commands you wish to run with it.

So, to capture with dvgrab, I added a new scheduled task, seleted the execute date/time and put in the command to run as:

dvgrab -f avi -d 01:10:00.00 ~/temp/capture/dvgrab

As you can see, I specified for the captured video to be saved in AVI format with "-f AVI". The "-d 01:10:00.00" parameter tells dvgrab to stop capturing after an hour and ten minutes. And finally, the last parameter tells dvgrab where to save the AVI file. By default, dvgrab will name its file "dvgrab001.avi" and will capture until the file is 2 GB in size, then will begin the second file and increment the number. It will keep doing this as necessary. I'm not sure why by default it uses a 2 GB file limit as most GNU/Linux filesystems can handle more than 2 GB files. But, I think there is a parameter to force it to combine everything to a single file if you wish. I should also mention that dvgrab will automatically select the default firewire capture device on your system. If you have multiple capturing devices, you may have to use the "-card" parameter to tell it which device to capture from. In Fedora, the devices show up as /dev/fw0 for the first device, /dev/fw1 as the second, and so on.

Back when I used Windows, I tried to do the same thing and had some adventures trying to find something that would work consistently and capture to an AVI file which is a standard format. I ended up using VirtualVCR which was shareware and ended up expiring on me. dvgrab is a wonderful, effective, and very simple tool, and does exactly one thing: capture video from a firewire DV source. And best of all since it's open source, there's no expiration! Great stuff, as always.

Editorial standards