Firewire Mini DV cameras on Linux

Yesterday at the office I found a small Sony camera. Obviously I had to get it working on Linux at all costs. And now that I found how I thought I’d share this bit of knowledge. The exact model is DCR-TRV60e but this post possibly applies to all Mini DV cameras.

You could use Kino and be done with it, but what if you want to automate recordings or broadcast a live stream? Let’s do it the CLI way.

The keyword here is dvgrab. It is a command line tool that talks to the camera and grabs the DV stream. Dvgrab can stream to a file or to the standard output. Let’s install dvgrab:

sudo apt-get install dvgrab

Now let’s load the firewire kernel modules:

sudo modprobe raw1394 ieee1394 video1394 ohci1394

In theory we could just use dvgrab and pipe the stream to any other program through UNIX pipes like this:

sudo dvgrab - | mplayer -

For some reason this does not work. Maybe it’s a bug, maybe I’m doing something wrong… So I hacked together a little script that uses UNIX fifos. Dvgrab writes to the fifo and mplayer reads from it. You can replace mplayer with any other tool such as VLC or ffmpeg and do lots of things.

DV_FIFO=/tmp/dvfifo
mkfifo "$DV_FIFO"
dvgrab -f dv2 - > "$DV_FIFO" &
mplayer "$DV_FIFO" -ni -cache 1024
killall dvgrab
rm "$DV_FIFO"
  1. me says:

    dvgrab -noavc -card 0 -f dv1 – | mplayer – -demuxer lavf -lavfdopts format=dv