網絡攝像機配置

出自 Arch Linux 中文维基

本文內容或本節內容已經過期。

原因: 請提供模板的第一個位置參數以概括原因。 (在Talk:網絡攝像機配置討論)

這篇文章或章節的翻譯不反映原文。

原因:Last updated in 2012 (235155), out of sync with English page(在 Talk:網絡攝像機配置# 中討論)

本文將幫助你在 Arch Linux 中安裝網絡攝像機。

識別你的網絡攝像機[編輯 | 編輯原始碼]

識別你的網絡攝像機的名稱並使用恰當的驅動程序。 下面列出部分網絡攝像機的名稱,以及它們所需的驅動程序。點擊設備名稱右邊的連結以獲取編譯模塊所需信息及其他相關信息。如果你正確設置並使用其他網絡攝像機,請將其名稱和驅動程序添加到列表中!

pwc[編輯 | 編輯原始碼]

  • Creative Labs Webcam Pro Ex (創新實驗室網絡攝像機專家加強版)
  • Logitech QuickCam Notebook Pro(羅技快看筆記本專用專家版,僅適用於「專家版」機型)
  • Logitech Quickcam Pro 4000
  • Philips ToUCams (not confirmed at the moment, but it is using the pwc driver if I remember correctly)

qc-usb[編輯 | 編輯原始碼]

  • Dexxa Webcam (Dexxa 網絡攝像機)
  • Labtec Webcam (old model) (Labtec 網絡攝像機,舊機型)
  • LegoCam
  • Logitech Quickcam Express (old model)(羅技快看加強版,舊機型)
  • Logitech QuickCam Notebook (羅技快看筆記本專用版,非「專家版」機型)
  • Logitech Quickcam Web (羅技快看網絡版)

qc-usb-messenger[編輯 | 編輯原始碼]

  • Logitech Quickcam Messenger
  • Logitech Quickcam Communicate

It is now in the community repo.

說明: 如果使用模塊 gspca 不能使 qc-usb-messenger 正常工作,安裝軟體包 gspcav1。
說明: 現在這驅動已經成為 kernel 2.6.27 的一個模塊

zr364xx[編輯 | 編輯原始碼]

這個驅動可以應用於很多電腦攝像頭,比如:

  • Aiptek PocketDV 3300
  • Creative PC-CAM 880
  • Konica Revio 2
  • Genius Digital Camera
  • Maxell Maxcam PRO DV3

你可以在這裡找到它所支持全部設備的列表:here. 你可以在這裡找到一個此驅動的PKGBUILD:AUR.

sn9c102[編輯 | 編輯原始碼]

  • Trust Spacecam series
  • Maxell Smartcam (for notebooks): 352x288 max. resolution @ 3fps

gspca[編輯 | 編輯原始碼]

支持的列表位於[1]

注意: 此驅動不支持 V4L1。

stv680[編輯 | 編輯原始碼]

最近兩年產於亞洲國家的一些沒有產品名的廉價攝像機多使用 stv680 晶片組。絕大多數此類攝像機均為新奇的玩意兒(即 Pencam、 SpyC@m 和 LegoCam)。

  • Aiptek PenCam 系列
  • Digitaldream 系列
  • Dolphin Peripherals 系列
  • Trust SpyC@m 系列
  • Lego LegoCam
  • Welback Coolcam

想要查閱更完整的使用 stv680 晶片組的網絡攝像機列表請點擊這裡.

linux-uvc[編輯 | 編輯原始碼]

  • Logitech Quickcam Pro 5000
  • Logitech Quickcam Pro 9000
  • Logitech Quickcam Orbit MP
  • Microdia Pavilion Webcam (on MSI PR200)

You can find a full list of supported UVC devices here.

自從 kernel 2.6.26 開始,linux-uvc 已經是kernel的一部分。只需要加載模塊 uvcvideo 即可。

Note: 但此驅動不支持V4L1。

ov51x-jpeg[編輯 | 編輯原始碼]

  • Sony EyeToy
  • Chicony DC-2120
  • Chicony DC-2120 pro
  • Trust Spacecam 320
  • Hercules Webcam Deluxe
  • Hercules Webcam Classic
  • Creative Live! Cam Notebook Pro VF0400
  • Creative Live! Cam Vista IM
  • Creative Live! Cam Vista IM VF0420
  • Creative Vista Webcam VF0330
  • ASUS webcam Model?
  • Philips PCVC820K/00
  • NGS showtime plus
  • HP VGA Webcam with Integrated Microphone

This is a kernel module found in the AUR with some additions to the original driver that provide jpeg decompression.

For me to get my "Creative Live! Cam Vista IM" working with Skype I had to add this line to /etc/modprobe.d/modprobe.conf

options ov51x-jpeg forceblock=1

r5u870 (Ricoh)[編輯 | 編輯原始碼]

  • HP Pavilion Webcam
  • HP Webcam 1000
  • Sony VAIO VGP-VCCx

絕大部分索尼的筆記本電腦採用Ricoh的網絡攝像機.

請安裝 r5u87xAUR (同時提供了固件) 並運行 loader 命令。

stk11xx (Syntek)[編輯 | 編輯原始碼]

  • Integrated camera in lot of Asus laptops
  • Asus A8J, F3S, F5R, F9E, VX2S, V1S, A6T

Just install stk11xx-svnAUR. It contains the right kernel module.

確定為你的網絡攝像機加載所需的模塊[編輯 | 編輯原始碼]

將網絡攝像頭的內核模塊 加入 /etc/modules-load.d/webcam.conf。這樣一來,當系統啟動時,你的網絡攝像機模塊就會加載到內核中。

如果你的攝像頭是使用USB接口,系統 應該會自動加載合適的驅動。 如果成功,可以在你插入攝像頭之後檢查dmesg,應該可以看到如下面的信息.

# dmesg | tail
sn9c102: V4L2 driver for SN9C10x PC Camera Controllers v1:1.24a
usb 1-1: SN9C10[12] PC Camera Controller detected (vid/pid 0x0C45/0x600D)
usb 1-1: PAS106B image sensor detected
usb 1-1: Initialization succeeded
usb 1-1: V4L2 device registered as /dev/video0
usb 1-1: Optional device control through 'sysfs' interface ready
usbcore: registered new driver sn9c102

權限[編輯 | 編輯原始碼]

要使用攝像頭,首先必須讓用戶對/dev/video0具備權限.

udev[編輯 | 編輯原始碼]

如果你使用udev (在kernel 2.6.13裡是默認的),你只需把用戶加到組video中:

$ groups

用root權限把用戶添加到組中:

# gpasswd -a <username> video

devfs[編輯 | 編輯原始碼]

將以下兩行添加到你的/etc/devfsd.conf. 文件中。這將允許普通用戶使用/dev/video0 (你的網絡攝像機)。

# Give normal users access to webcam
REGISTER        video0       PERMISSIONS     root.users 0660

獲取軟體以使用你的網絡攝像機[編輯 | 編輯原始碼]

Version 2.6.27 of the Linux kernel supports many new webcam drivers. Legacy Video4Linux API has been dropped, and these drivers now only support Video4Linux version 2. Pixel format decoding has been pushed to user space, since Video4Linux version 2 does not support kernel space decoding. The libv4l library provides userland applications with pixel decoding services and will be used by most programs. Other compatibility layers are also available.

If your device is created but your image looks strange (mine was nearly completely green), you probably need this.

If the application has V4L2 support but no pixelformat support (eg: cheese) then use the following command:

 LD_PRELOAD=/usr/lib/libv4l/v4l2convert.so cheese

If the application only supports the older version of V4L (skype is the most popular of this kind of software) then use this command:

 LD_PRELOAD=/usr/lib/libv4l/v4l1compat.so skype

Hint: 為了不用每次都輸入長長的命令,根據使用攝像機的類型,可以在~/.bashrc或~/.xinitrc裡添加一條命令。比如:

 export LD_PRELOAD=/usr/lib/libv4l/v4l2convert.so

或者

 export LD_PRELOAD=/usr/lib/libv4l/v4l1compat.so

Cheese[編輯 | 編輯原始碼]

Cheese is the GNOME photo/video taking client. It is similar to Photo Booth in Mac OS X. It is now in extra and is also part of the gnome-extra group

GTK+ UVC Viewer (guvcview)[編輯 | 編輯原始碼]

guvcview is a simple GTK interface for capturing (with sound!) and viewing video from devices supported by the linux UVC driver. Available in the guvcview

Kopete[編輯 | 編輯原始碼]

Kopete is the KDE instant messaging (IM) client. As of KDE 3.5, it has support for MSN and Yahoo! webcams, but not every cam works yet. It is included in the kdenetwork package.

Kamoso[編輯 | 編輯原始碼]

Application to take pictures and videos out of your webcam for KDE. Available in the AUR: kamoso.

xawtv[編輯 | 編輯原始碼]

這是一個基本的 Video4Linux 設備查看器,儘管它專用於電視調節卡,但其亦可很好地管理網絡攝像機。它會在窗口中顯示你的網絡攝像機所看到的一切。可以使用以下命令安裝:

# pacman -S xawtv

運行以下命令:

$ xawtv -c /dev/video0

If you are using an nVidia graphic card, and you get an error like

X Error of failed request:  XF86DGANoDirectVideoMode
 Major opcode of failed request:  139 (XFree86-DGA)
 Minor opcode of failed request:  1 (XF86DGAGetVideoLL)
 Serial number of failed request:  69
 Current serial number in output stream:  69

you should instead run it as:

$ xawtv -nodga

VLC[編輯 | 編輯原始碼]

VLC can also be used to view and record your webcam. In VLC's file menu, open the 'Capture Device...' dialog and enter the video and audio device files. Or from the command line, do:

$ vlc v4l:// :v4l-vdev="/dev/video0" :v4l-adev="/dev/audio2"

This will make VLC mirror your webcam. To take stills, simply choose 'Snapshot' in the 'Video' menu. To record the stream, you add a --sout argument, e.g.

$ vlc v4l:// :v4l-vdev="/dev/video0" :v4l-adev="/dev/audio2" --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}}"

(Obviously a bit overkill with regard to the bitrates but it is fine for testing purposes.) Notice that this will not produce a mirror on the display - in order to see what you are recording, you would need to add the display as a destination to the argument:

... :duplicate{dst=display,dst=std{access= ....

(Though this can tax older hardware somewhat...)

MPlayer[編輯 | 編輯原始碼]

使用 MPlayer來給攝像頭截屏,需要在終端中運行下列命令:

$ mplayer tv:// -tv driver=v4l2:width=640:height=480:device=/dev/video0 -fps 15 -vf screenshot

From here you have to press s to take the snapshot. The snapshot will be saved in your current folder as shotXXXX.png. 使用如下命令,來錄製視頻:

$ mencoder tv:// -tv driver=v4l2:width=640:height=480:device=/dev/video0:forceaudio:adevice=/dev/dsp -ovc lavc -oac mp3lame -lameopts cbr:br=64:mode=3 -o <filename>.avi

按Ctrl+Z停止錄製。

FFmpeg[編輯 | 編輯原始碼]

參見 FFmpeg#Recording webcam.

ekiga[編輯 | 編輯原始碼]

這是一款非常類似於 Microsoft Netmeeting 的軟體,以前名叫gnomemeeting。 可以使用以下命令安裝:

# pacman -S ekiga

該程序會自動為你設置好一切。

Sonic-snap[編輯 | 編輯原始碼]

sonic-snapAUR[損壞的連結:package not found] [2] is a viewer/grabber for sn9c102-based webcams only.

Skype[編輯 | 編輯原始碼]

新版的skype具備視頻支持。 在選項設置中,測試攝像頭,可雙擊全屏。使用一下命令安裝:

# pacman -S skype

如果從 skype 中獲得的圖片出現顏色不正常,請閱讀使用網絡攝像頭軟體.

如果運行 x86-64,需要安裝 Multilib 倉庫中的 lib32-v4l-utils,並用下面命令運行 skype:

LD_PRELOAD=/usr/lib32/libv4l/v4l1compat.so skype

可以設置 skype 別名或修改 Skype 圖標的命令行以方便使用。