个人工具

UbuntuHelp:Firewire

来自Ubuntu中文

Wikibot讨论 | 贡献2009年11月17日 (二) 19:08的版本

跳转至: 导航, 搜索


<<Include(Tag/ContentCleanup)>> There are two entries for 'Firewire/Wire' The second entry is here https://help.ubuntu.com/community/FireWire and deals with 1394 audio devices.

Capturing video over Firewire

Introduction

This page explains how to capture a Digital Video (DV) stream over IEEE1394 (Firewire) hardware with the Kino Video Editor.

Disclaimer

This section on using IEEE1394 is not written by a hardware expert. It probably contains mistakes. If you know something is wrong or missing please help improve this page for the next person by correcting it. DuncanLithgow

Requirements

Hardware

If your computer has no Firewire port you can buy a PCI expansion card or PC Card. Be sure to check that your system's BIOS will support the card. You can ask for help at https://answers.launchpad.net/ubuntu

Software

Several Linux distributions, including Ubuntu, do not support video capture via !FireWire by default, so you will need some extra software. The dvgrab package uses a device file (also known as a node) to act as an interface between your camera and video editor (in this case Kino) over the Firewire port. When you connect your camera and turn it on, the udev package should create one or more of the device files/nodes needed. The device file will be one of the following:

  • /dev/dv1394/0 (gives access to Firewire for video capture but not to the camera's controls)
  • /dev/raw1394 (gives raw access to Firewire and allows access to your cameras controls, but possesses a security risk)

Capturing DV over Firewire

Once Kino is ready to use capture should work as follows: 1.#1 Connect your DV camera via Firewire, turn the camera on and press 'play'. 1.#1 udev detects the change and creates the required device nodes for communication with your camera. 1.#1 Start Kino and switch to the 'Capture' tab. Kino sees the device nodes are created and that you have permission to use them. Once Kino has seen the camera you can rewind your camera to the beginning of the tape again.

Troubleshooting

If Ubuntu doesn't automatically create a device node you can force the creation by typing the following in a Terminal:

gksudo modprobe raw1394
gksudo modprobe dv1394

However, these drivers should already be loaded automatically when the camcorder was plugged in/ switched on. If they were not auto-loaded, then there is a lower-level problem and it may be time to seek help at the linux1394-user mailing list. Furthermore, if the tips in this guide do not work please file a bug in launchpad against Kino.

Before Ubuntu 7.10 (Gutsy)

/dev/dv1394/0 has been the preferred method in Ubuntu as discussed in Launchpad Bug# 6290. Some versions of Kino from before Ubuntu 7.10 (Gutsy) may try /dev/raw1394 by default though, which will fail for a normal user. You will see the error:

WARNING: raw1394 kernel module not loaded or failure to read/write /dev/raw1394!

This is not a bug, but a security measure which you can read about in an email about firewire security from Scott James Remnant. This email paints an incomplete picture though. The actual risks of user access to raw1394 are:

  • It allows direct control of !FireWire-attached devices. (However, in order to do something really dangerous like overwriting device firmware or reading/modifying data from a !FireWire storage device, the user would need non-trivial purpose-made software.)
  • It may allow read/write access to memory of other PCs which are plugged into the !FireWire bus together with this PC which runs raw1394. Whether such access is possible and to which extent depends on the remote PC's operating system and hardware platform.
  • It may allow read/write access to memory of this PC if you have more than one !FireWire controller and plug them together to a single bus. This depends on settings of the ohci1394 kernel driver and on the hardware platform of this PC.

An easy way around this for a user who is also the administrator of the computer is to run Kino from the command line as root:

gksudo kino

However, running complex application software as root has its own dangers and should be avoided. Therefore, read further below for the steps necessary to allow normal users access to /dev/raw1394. Another note on !FireWire security: If you are afraid that others access your computer by plugging something (another PC) into your PC's !FireWire port and running forensic tools, then you need to unload the ohci1394 driver, at least while you leave your PC unsupervised. !FireWire security will be addressed in future releases by means of new improved kernel drivers: https://blueprints.launchpad.net/ubuntu/+spec/firewire-core

Ubuntu 7.10 (Gutsy Gibbon)

This version of Ubuntu and Kino only works for /dev/raw1394 - only available to root users. Connect and start your camera, start Kino as root and switch to the 'Capture' tab.

Ubuntu 8.04 (Hardy Heron)

For this release Kino has changed their setup so that use of /dev/dv1394/0 is not enabled by default. Instead /dev/raw1394 is prefered. Because of this change Kino has been compiled incorrectly for use in Ubuntu, and only works for /dev/raw1394 - only available to root users. A correctly compiled version is available here: kino_1.3.0-2ubuntu0_i386.deb. This version will not install on Ubuntu 8.10.

Ubuntu 8.10 (Intrepid Ibix)

This version of Ubuntu and Kino has been compiled incorrectly, and only works for /dev/raw1394 - only available to root users. Connect and start your camera, start Kino as root and switch to the 'Capture' tab.

Other methods

Method 1. 'raw1394'

This method makes a new group called firewire with control of the raw1394 device file, and your user a member of that group. The camcoder must be plugged in and turned on at boot time for this to work because udev will only create /dev/raw1394 if the camcoder is present and /dev/raw1394 must be created before bootmisc.sh is run.

  1. Open 'System > Administration > Users and Groups'. Add a new group and call it firewire
  2. Open the firewire group and add your user name to this group.
  3. Open a terminal and type
    sudo gedit /etc/init.d/bootmisc.sh
    
  4. At the end of the file type
    chgrp firewire /dev/raw1394
    
  5. Reboot, or to apply changes now type directly in a terminal
    sudo chgrp firewire /dev/raw1394
    
  6. Insure camcorder is connected and turned on before the system is booted.

Method 2. 'Desktop Launcher'

Create a Desktop launcher named "EnableCamcorderConnection". Set the launcher type to "Application In terminal" and the launcher command to "sudo chmod 666 /dev/raw1394". Execute the launcher after plugging in the camcorder.

Method 3. 'udev rule'

As the most straight-forward method, simply add the raw1394 specific udev rule which was left out by Ubuntu's udev maintainers:

echo 'KERNEL=="raw1394", GROUP="video"' > /tmp/raw1394.rules
sudo cp /tmp/raw1394.rules /etc/udev/rules.d/
rm /tmp/raw1394.rules

Then unload and reload raw1394 or reboot to make this change effective.

See Also

Page janitor: DuncanLithgow