个人工具

“UbuntuHelp:Webcam”的版本间的差异

来自Ubuntu中文

跳转至: 导航, 搜索
第1行: 第1行:
 
{{From|https://help.ubuntu.com/community/Webcam}}
 
{{From|https://help.ubuntu.com/community/Webcam}}
 
{{Languages|UbuntuHelp:Webcam}}
 
{{Languages|UbuntuHelp:Webcam}}
 +
=== Random terribly formatted addition ===
 +
Ok, I had trouble with this guide, as it stands, so here is my experience.  May it serve you well.  I bought a UVC compliant webcam, listed on the fsf.org webpage, and had lots of trouble at first.  On Hardy, only ekiga would work the webcam.  On  Intrepid-alpha, 27.2 kernel, Ekiga still worked, along with cheese and xawtv.  Camorama didn't work at all for me.  gstreamer-properties was another useful program for testing the webcam.  Hope the elucidation of my experience saves you some time.
 
=== Driver installation ===
 
=== Driver installation ===
 
Many cameras work out-of-the-box. If needed, try [[UbuntuHelp:EasyCam|EasyCam]], a tool for installing webcam drivers. If you are unable to manage installing your Webcam using [[UbuntuHelp:EasyCam|EasyCam]], you may try installing your camera manually. At the end of this page are some links to help you with this.
 
Many cameras work out-of-the-box. If needed, try [[UbuntuHelp:EasyCam|EasyCam]], a tool for installing webcam drivers. If you are unable to manage installing your Webcam using [[UbuntuHelp:EasyCam|EasyCam]], you may try installing your camera manually. At the end of this page are some links to help you with this.
 
=== Testing your webcam ===
 
=== Testing your webcam ===
 +
For UVC devices ''luvcview'' is a good program you can use to test that the camera is working.
 +
<pre><nowiki>
 +
sudo apt-get install luvcview
 +
</nowiki></pre>
 +
If it doesn't work, you may need to update the UVC driver (see Manual install instructions below).
 
There is a nifty little application called [http://camorama.fixedgear.org/ camorama] to view, alter and save images from a webcam. Simply install it via apt:
 
There is a nifty little application called [http://camorama.fixedgear.org/ camorama] to view, alter and save images from a webcam. Simply install it via apt:
 
<pre><nowiki>
 
<pre><nowiki>
第12行: 第19行:
 
sudo apt-get install xawtv
 
sudo apt-get install xawtv
 
</nowiki></pre>
 
</nowiki></pre>
 +
''VLC'' also counts webcam display and recording among its many talents.
 +
<pre><nowiki>
 +
sudo apt-get install vlc
 +
</nowiki></pre>
 +
''[http://www.gnome.org/projects/cheese/ Cheese]'' is the new and fancy photo shooting/video grabbing utility for Gnome, quite similar to Photobooth for OSX.
 +
<pre><nowiki>
 +
sudo apt-get install cheese
 +
</nowiki></pre>
 +
In some cases you (VLC, mplayer, amongst others) will need to know the video and audio device files for your webcam. Before you plug in your webcam, try the following two command at a console:
 +
<pre><nowiki>
 +
ls /dev/video*
 +
ls /dev/audio*
 +
</nowiki></pre>
 +
Make a note of the devices appearing. Now plug in your webcam, allow the system a few seconds to register the device, and run the two commands again. The new appearances should belong to your webcam (for instance, /dev/video0 and /dev/audio2).
 
=== Additional software ===
 
=== Additional software ===
 
If you want to have a little tray system icon that notifies you when your webcam is on, try [http://infinito.f2o.org/cameramonitor/ Camera Monitor]. There is even a [http://infinito.f2o.org/cameramonitor/cameramonitor_0.1-1_i386.deb debian/ubuntu package] available.
 
If you want to have a little tray system icon that notifies you when your webcam is on, try [http://infinito.f2o.org/cameramonitor/ Camera Monitor]. There is even a [http://infinito.f2o.org/cameramonitor/cameramonitor_0.1-1_i386.deb debian/ubuntu package] available.
第20行: 第41行:
 
sudo apt-get install ekiga
 
sudo apt-get install ekiga
 
</nowiki></pre>
 
</nowiki></pre>
=== Recording to an AVI file ===
+
=== Recording video ===
 +
==== [[UbuntuHelp:MPlayer|MPlayer]] / [[UbuntuHelp:MEncoder|MEncoder]] ====
 
[[UbuntuHelp:MPlayer|MPlayer]] is capaple of displaying a webcam video stream, for example with the command line
 
[[UbuntuHelp:MPlayer|MPlayer]] is capaple of displaying a webcam video stream, for example with the command line
 
<pre><nowiki>
 
<pre><nowiki>
 
mplayer tv:// -tv driver=v4l:width=640:height=480:device=/dev/video0
 
mplayer tv:// -tv driver=v4l:width=640:height=480:device=/dev/video0
 
</nowiki></pre>
 
</nowiki></pre>
The resolution (width=??? & height=??? ) should be chosen to match the output of your device.  
+
The resolution (width=??? & height=??? ) should be chosen to match the output of your device, and the device file (/dev/video0) to match your webcam's device file, see above.
 
The companion to [[UbuntuHelp:MPlayer|MPlayer]], [[UbuntuHelp:MEncoder|MEncoder]] can record from a webcam to video files such as AVI, for example without audio:
 
The companion to [[UbuntuHelp:MPlayer|MPlayer]], [[UbuntuHelp:MEncoder|MEncoder]] can record from a webcam to video files such as AVI, for example without audio:
 
<pre><nowiki>
 
<pre><nowiki>
第34行: 第56行:
 
mencoder tv:// -tv driver=v4l:width=320:height=240:device=/dev/video0:forceaudio:adevice=/dev/dsp1 -ovc lavc -oac mp3lame -lameopts cbr:br=64:mode=3 -o webcam.avi
 
mencoder tv:// -tv driver=v4l:width=320:height=240:device=/dev/video0:forceaudio:adevice=/dev/dsp1 -ovc lavc -oac mp3lame -lameopts cbr:br=64:mode=3 -o webcam.avi
 
</nowiki></pre>
 
</nowiki></pre>
Type 'man mencoder' for more info on the audio options. In the example, /dev/dsp1 refers to the webcam USB Audio device, while /dev/dsp would refer to the sound card
+
Type 'man mencoder' for more info on the audio options. In the example, /dev/dsp1 refers to the webcam USB Audio device, while /dev/dsp would refer to the sound card.
 
You may need to install these programs with  
 
You may need to install these programs with  
 
<pre><nowiki>
 
<pre><nowiki>
 
sudo apt-get install mplayer mencoder
 
sudo apt-get install mplayer mencoder
 
</nowiki></pre>
 
</nowiki></pre>
 +
==== VLC ====
 +
In VLC, choose 'Open capture device' from the file menu and enter the video and audio device files (see above) in video device name and audio device name, respectively. If you just want a 'mirror' (to see what the webcam is showing), click 'OK' and you're done. If you wish to record, tick off 'Stream/save' in the 'Advanced options' section. Click the settings button right next to it. Tick 'File' off under 'Outputs' and enter a filename. Encapsulation method can be left at the default (MPEG TS). Under 'Transcoding options', tick 'Audio codec' and 'Video codec'. These can also safely be left the defaults (obviously greater compression results in lower file sizes, so experiment). Click 'OK' in the Settings screen and
 +
once again in the main webcam screen (Video4linux). If you want to have more control, you can access several settings, including resolution,  by clicking the Advanced options button.
 +
If you wish to be able to quickly start a video session with your webcam, the resulting vlc command is printed in the Customize line at the bottom. You simply need to prepend 'vlc', e.g.
 +
<pre><nowiki>
 +
vlc v4l:// :v4l-vdev="/dev/video0" :v4l-adev="/dev/audio2" :v4l-norm=3 :v4l-frequency=-1 :v4l-caching=300 :v4l-chroma="" :v4l-fps=-1.000000 :v4l-samplerate=44100 :v4l-channel=0 :v4l-tuner=-1 :v4l-audio=-1 :v4l-stereo :v4l-width=640 :v4l-height=480 :v4l-brightness=-1 :v4l-colour=-1 :v4l-hue=-1 :v4l-contrast=-1 :no-v4l-mjpeg :v4l-decimation=1 :v4l-quality=100
 +
</nowiki></pre>
 +
The recording instructions will similarly need to be appended. Copy the contents of the 'Stream Output MRL' box under 'Settings' and
 +
change ":sout=" to "--sout " and append it to your vlc command:, e.g.
 +
<pre><nowiki>
 +
vlc v4l:// :v4l-vdev="/dev/video0" :v4l-adev="/dev/audio2" :v4l-norm=3 :v4l-frequency=-1 :v4l-caching=300 :v4l-chroma="" :v4l-fps=-1.000000 :v4l-samplerate=44100 :v4l-channel=0 :v4l-tuner=-1 :v4l-audio=-1 :v4l-stereo :v4l-width=640 :v4l-height=480 :v4l-brightness=-1 :v4l-colour=-1 :v4l-hue=-1 :v4l-contrast=-1 :no-v4l-mjpeg :v4l-decimation=1 :v4l-quality=100 --sout "#transcode{vcodec=mp1v,vb=1024,scale=1,acodec=mpga,ab=192,channels=2}:duplicate{dst=std{access=file,mux=mpeg1,dst=/tmp/test.mpg}}"
 +
</nowiki></pre>
 +
To simple take a few snapshots, open the webcam without recording and choose 'Snapshot' under the 'Video' menu.
 
=== Manual installation instructions ===
 
=== Manual installation instructions ===
 
==== Installing spca5xx manually ====
 
==== Installing spca5xx manually ====
You can find howto's for manual installation of the spca5xx driver [[UbuntuWiki:Spca5xx|here]].
+
You can find howto's for manual installation of the spca5xx driver [[UbuntuHelp:Spca5xx|here]].
 
==== Installing ov51x manually ====
 
==== Installing ov51x manually ====
 
You can find howto's for manual installation of the ov51x driver [[UbuntuHelp:Ov51x|here]].
 
You can find howto's for manual installation of the ov51x driver [[UbuntuHelp:Ov51x|here]].
第47行: 第82行:
 
This is a hacked driver by http://www.rastageeks.org/ and more info is available at http://www.rastageeks.org/ov51x-jpeg/index.php/Main_Page
 
This is a hacked driver by http://www.rastageeks.org/ and more info is available at http://www.rastageeks.org/ov51x-jpeg/index.php/Main_Page
 
Suported hardware http://www.rastageeks.org/ov51x-jpeg/index.php/Working_Webcams
 
Suported hardware http://www.rastageeks.org/ov51x-jpeg/index.php/Working_Webcams
My webcam is a Creative Live! Cam Vista IM and I found the instructions ready to go on the wiki very good. Installed it in 30 seconds
+
(July 16 2008) Currently the source package for ov51x-jpeg doesn't compile, but you can use [http://overtag.dk/wordpress/2008/07/creative-live-cam-on-ubuntu-804-using-ov51x-jpeg/ this howto] to get it running.
 
==== Installing UVC manually ====
 
==== Installing UVC manually ====
The UVC module is included in 7.10, and possibly earlier but the included version has problems with some webcams. If you need to install/update it you can find a howto [[UbuntuHelp:UVC|here]]
+
The UVC module is included in 7.10 and later, and possibly earlier but the included version has problems with some webcams. If you need to install/update it you can find a howto [[UbuntuHelp:UVC|here]]
 
=== Edgy troubleshooting : pwc driver is broken ===
 
=== Edgy troubleshooting : pwc driver is broken ===
 
On Edgy, the pwc driver in the kernel is [https://launchpad.net/distros/ubuntu/+source/linux-source-2.6.17/+bug/56090 broken].
 
On Edgy, the pwc driver in the kernel is [https://launchpad.net/distros/ubuntu/+source/linux-source-2.6.17/+bug/56090 broken].
 
[http://www.lavrsen.dk/twiki/bin/view/PWC/WorkingWebcamsWithPWC List of the working webcams with pwc.]
 
[http://www.lavrsen.dk/twiki/bin/view/PWC/WorkingWebcamsWithPWC List of the working webcams with pwc.]
 
An easy check to see if your pwc driver is broken :
 
An easy check to see if your pwc driver is broken :
<pre><nowiki>$ lsmod | grep pwc
+
<pre><nowiki>
 +
$ lsmod | grep pwc
  
 
pwc 51964 1  <- Your driver is broken ! (around 50kb)
 
pwc 51964 1  <- Your driver is broken ! (around 50kb)
第99行: 第135行:
 
=== See also ===
 
=== See also ===
 
* [[UbuntuHelp:InstallingLogitechQuickcamPro5000OnEdgy|InstallingLogitechQuickcamPro5000OnEdgy]]
 
* [[UbuntuHelp:InstallingLogitechQuickcamPro5000OnEdgy|InstallingLogitechQuickcamPro5000OnEdgy]]
* [[UbuntuHelp:InstallingEyetoyAsAWebcam|Installing the Eyetoy as a Webcam with Kopete]]
+
* [[UbuntuHelp:InstallingEyetoyAsAWebcam|Installing|the Eyetoy as a Webcam with Kopete]]
* [http://www.buberel.org/serendipity/index.php?/archives/260-Using-a-USB-Webcam-on-Ubuntu-Linux-to-produce-good-quality-video-captures-that-can-be-uploaded-to-YouTube-directly.html Using a USB Webcame to capture videos for upload to YouTube]
+
* [http://jbuberel.typepad.com/blog/2008/03/using-a-usb-web.html Using a USB Webcam to capture videos for upload to YouTube]
 
----
 
----
 
[[category:CategoryDocumentation]] [[category:CategoryCleanup]]
 
[[category:CategoryDocumentation]] [[category:CategoryCleanup]]
  
 
[[category:UbuntuHelp]]
 
[[category:UbuntuHelp]]

2008年10月19日 (日) 18:01的版本


Random terribly formatted addition

Ok, I had trouble with this guide, as it stands, so here is my experience. May it serve you well. I bought a UVC compliant webcam, listed on the fsf.org webpage, and had lots of trouble at first. On Hardy, only ekiga would work the webcam. On Intrepid-alpha, 27.2 kernel, Ekiga still worked, along with cheese and xawtv. Camorama didn't work at all for me. gstreamer-properties was another useful program for testing the webcam. Hope the elucidation of my experience saves you some time.

Driver installation

Many cameras work out-of-the-box. If needed, try EasyCam, a tool for installing webcam drivers. If you are unable to manage installing your Webcam using EasyCam, you may try installing your camera manually. At the end of this page are some links to help you with this.

Testing your webcam

For UVC devices luvcview is a good program you can use to test that the camera is working.

sudo apt-get install luvcview

If it doesn't work, you may need to update the UVC driver (see Manual install instructions below). There is a nifty little application called camorama to view, alter and save images from a webcam. Simply install it via apt:

sudo apt-get install camorama

xawtv is another program you can use to test the camera.

sudo apt-get install xawtv

VLC also counts webcam display and recording among its many talents.

sudo apt-get install vlc

Cheese is the new and fancy photo shooting/video grabbing utility for Gnome, quite similar to Photobooth for OSX.

sudo apt-get install cheese

In some cases you (VLC, mplayer, amongst others) will need to know the video and audio device files for your webcam. Before you plug in your webcam, try the following two command at a console:

ls /dev/video*
ls /dev/audio*

Make a note of the devices appearing. Now plug in your webcam, allow the system a few seconds to register the device, and run the two commands again. The new appearances should belong to your webcam (for instance, /dev/video0 and /dev/audio2).

Additional software

If you want to have a little tray system icon that notifies you when your webcam is on, try Camera Monitor. There is even a debian/ubuntu package available. Webcam support is built in to aMSN, kopete, ekiga and Skype 2.0. As usual, install with

sudo apt-get install kopete
sudo apt-get install amsn
sudo apt-get install ekiga

Recording video

MPlayer / MEncoder

MPlayer is capaple of displaying a webcam video stream, for example with the command line

mplayer tv:// -tv driver=v4l:width=640:height=480:device=/dev/video0

The resolution (width=??? & height=??? ) should be chosen to match the output of your device, and the device file (/dev/video0) to match your webcam's device file, see above. The companion to MPlayer, MEncoder can record from a webcam to video files such as AVI, for example without audio:

mencoder tv:// -tv driver=v4l:width=320:height=240:device=/dev/video0 -ovc lavc -o webcam.avi

and with audio

mencoder tv:// -tv driver=v4l:width=320:height=240:device=/dev/video0:forceaudio:adevice=/dev/dsp1 -ovc lavc -oac mp3lame -lameopts cbr:br=64:mode=3 -o webcam.avi

Type 'man mencoder' for more info on the audio options. In the example, /dev/dsp1 refers to the webcam USB Audio device, while /dev/dsp would refer to the sound card. You may need to install these programs with

sudo apt-get install mplayer mencoder

VLC

In VLC, choose 'Open capture device' from the file menu and enter the video and audio device files (see above) in video device name and audio device name, respectively. If you just want a 'mirror' (to see what the webcam is showing), click 'OK' and you're done. If you wish to record, tick off 'Stream/save' in the 'Advanced options' section. Click the settings button right next to it. Tick 'File' off under 'Outputs' and enter a filename. Encapsulation method can be left at the default (MPEG TS). Under 'Transcoding options', tick 'Audio codec' and 'Video codec'. These can also safely be left the defaults (obviously greater compression results in lower file sizes, so experiment). Click 'OK' in the Settings screen and once again in the main webcam screen (Video4linux). If you want to have more control, you can access several settings, including resolution, by clicking the Advanced options button. If you wish to be able to quickly start a video session with your webcam, the resulting vlc command is printed in the Customize line at the bottom. You simply need to prepend 'vlc', e.g.

vlc v4l:// :v4l-vdev="/dev/video0" :v4l-adev="/dev/audio2" :v4l-norm=3 :v4l-frequency=-1 :v4l-caching=300 :v4l-chroma="" :v4l-fps=-1.000000 :v4l-samplerate=44100 :v4l-channel=0 :v4l-tuner=-1 :v4l-audio=-1 :v4l-stereo :v4l-width=640 :v4l-height=480 :v4l-brightness=-1 :v4l-colour=-1 :v4l-hue=-1 :v4l-contrast=-1 :no-v4l-mjpeg :v4l-decimation=1 :v4l-quality=100

The recording instructions will similarly need to be appended. Copy the contents of the 'Stream Output MRL' box under 'Settings' and change ":sout=" to "--sout " and append it to your vlc command:, e.g.

vlc v4l:// :v4l-vdev="/dev/video0" :v4l-adev="/dev/audio2" :v4l-norm=3 :v4l-frequency=-1 :v4l-caching=300 :v4l-chroma="" :v4l-fps=-1.000000 :v4l-samplerate=44100 :v4l-channel=0 :v4l-tuner=-1 :v4l-audio=-1 :v4l-stereo :v4l-width=640 :v4l-height=480 :v4l-brightness=-1 :v4l-colour=-1 :v4l-hue=-1 :v4l-contrast=-1 :no-v4l-mjpeg :v4l-decimation=1 :v4l-quality=100 --sout "#transcode{vcodec=mp1v,vb=1024,scale=1,acodec=mpga,ab=192,channels=2}:duplicate{dst=std{access=file,mux=mpeg1,dst=/tmp/test.mpg}}"

To simple take a few snapshots, open the webcam without recording and choose 'Snapshot' under the 'Video' menu.

Manual installation instructions

Installing spca5xx manually

You can find howto's for manual installation of the spca5xx driver here.

Installing ov51x manually

You can find howto's for manual installation of the ov51x driver here.

Installing ov51x-jpeg manually

This is a hacked driver by http://www.rastageeks.org/ and more info is available at http://www.rastageeks.org/ov51x-jpeg/index.php/Main_Page Suported hardware http://www.rastageeks.org/ov51x-jpeg/index.php/Working_Webcams (July 16 2008) Currently the source package for ov51x-jpeg doesn't compile, but you can use this howto to get it running.

Installing UVC manually

The UVC module is included in 7.10 and later, and possibly earlier but the included version has problems with some webcams. If you need to install/update it you can find a howto here

Edgy troubleshooting : pwc driver is broken

On Edgy, the pwc driver in the kernel is broken. List of the working webcams with pwc. An easy check to see if your pwc driver is broken :

$ lsmod | grep pwc

pwc 51964 1  <- Your driver is broken ! (around 50kb)

pwc 93984 0  <- your driver seems ok. (around 90kb)

How to get your webcam working ? 1) Install build-essential and the kernel-headers for your kernel (linux-headers-2.6.17-6-686 for me). 2) Download latest driver from http://www.saillard.org/linux/pwc/ (http://www.saillard.org/linux/pwc/files/pwc-10.0.12-rc1.tar.bz2 for me) 3) Unpack and go into extracted directory 4)

make

5)

sudo modprobe -r pwc

6)

sudo cp pwc.ko /lib/modules/`uname -r`/kernel/drivers/media/video/pwc/pwc.ko.saillard

7)

cd /lib/modules/`uname -r`/kernel/drivers/media/video/pwc

8)

sudo mv pwc.ko pwc.ko.ubuntu

9)

sudo ln -s pwc.ko.saillard pwc.ko

10)

sudo depmod -a

11)

sudo modprobe pwc

12) Enjoy! :)

See also