Linux video capture over firewire (IEEE1394)

From Organic Design


You may need to add the debian multimedia repository to your sources list.

apt-get -y install dvgrab libraw1394-8 libavc1394-0 libiec61883-0


In order to do DV video we use libraw1394 to import a digital video stream from the camera and also to give it commands like pause, record and fast-forward (known as AVC commands).

Plug the firewire PCI card into the PC and boot up.

grep 1394 /var/log/messages
Nov  8 11:49:09 colourbox kernel: ohci1394: fw-host0: OHCI-1394 1.1 (PCI): IRQ=[11]  MMIO=[42100000-421007ff]  Max Packet=[2048]  IR/IT contexts=[4/8]
Nov  8 11:49:09 colourbox kernel: eth1394: eth1: IEEE-1394 IPv4 over 1394 Ethernet (fw-host0)

This tells you that linux has registered the card and has activated two interfaces: A firewire host controller and an Ethernet over firewire device.

This is a potential problem because I don't want to use firewire for networking. In my case the firewire ethernet driver was binding to the camera device, preventing dvgrab from being able to record the video. So we disable the 1394 ethernet driver with:

rmmod eth1394

It's possible to set this to be the default behavior, perhaps in /etc/modprobe.d/blacklist. Now do this:

tail -f /var/log/messages

Power on the DV camera and plug it into the firewire port. Something like this should appear on the console.

Nov  8 14:41:51 colourbox kernel: ieee1394: raw1394: /dev/raw1394 device initialized

This means the raw1394 driver has connected to the camera. You're ready to capture some video.

dvgrab --format raw --noavc foo

This will begin capturing from DV immediately in raw DV format, naming the files beginning with foo... in the current directory.

You can then use mplayer to play back the DV stream.