Webcams a Linux
Contingut
- https://help.ubuntu.com/community/Webcam
- Llista de webcams compatibles: http://linux-uvc.berlios.de/
La idea és fer videos per penjar al Youtube. Molts videos es faran capturant la pantalla de l'escriptori, amb recordmydesktop, però en una finestra de l'escriptori s'hauria de veure una finestra amb la webcam que mostri el que estic fent (com per exemple tocar un instrument...)
Per provar el funcionament de les càmeres, necessito clients que puguin mostrar el video en una finestra:
$ sudo apt-get install xawtv $ sudo apt-get install cheese -> em deixa veure i escollir la resolució $ sudo apt-get install luvcview $ sudo apt-get install camorama -> no és compatible amb V4L2
A part, hi ha programes per fer videoconferències, com emesene, skipe,...
Logitech QuickCam Messanger
La webcam que m'ha passat el Rob és una logitech V-UM14 (és una QuickCam Messanger)
I have a pretty old logitech webcam that I want to see if I can use with linux ubuntu 8.04. Linux does not detect it automatically, so I wanted to see if there was a way to intall the drivers manually. I hope someone can help me!
M/N V-UM14 P/N 861092-0020 S/N PMA 41715764
$ lsusb ... Bus 005 Device 004: ID 046d:08f0 Logitech, Inc. QuickCam Messenger ...
Linux Driver for Quickcam USB cameras: http://qce-ga.sourceforge.net/ -> llegeixo que aquest driver no suporta la QuickCam Messanger, però un altre driver sí: http://home.mag.cx/messenger/
- http://home.mag.cx/messenger/ -> aquí està la solució
Em descarrego qc-usb-messenger-1.8.tar.gz
This is a linux driver for Quickcam Messenger and Quickcam Communicate. (Thanks to Mathias Kuster who found a working init-string that resulted into frames in bayes-format.) The driver is based on qc-usb-0.6.2, but I have removed the support for all cameras except Quickcam Messenger in this source, since I don't have any other cameras at home. Here is some information about the driver: Support for Quickcam Messenger (0x046D, 0x08F0) & (0x046D, 0x08F6) Support for Quickcam Communicate (0x046D, 0x08F5) 162x124, 162x248, 324x124, 324x248 resolution available Auto exposure works (need some tuning though) Auto shutter-control works (need some tuning though) Read status of the camera snapshot button Compressed format is still unknown Driver is compiled and tested with Quickcam Messenger and Fedora Core 1 (kernel 2.4.22-1.2197.nptl) and Fedora Core 3 (kernel 2.6.9-1.667smp). Fedora Core 4 (kernel 2.6.14-1.1637_FC4). Fedora Core 6 Kernel 2.6.15 Kernel 2.6.18 Kernel 2.6.19 Ubunto Feisty, Kernel 2.6.20 I have sucessfully tried some applications: xawtv -c /dev/video0 camorama gspy (patched version works) gnomemeetings (perhaps not working during conversation though...) ./show ./testquickcam /dev/video0 -m producer -da -dt -vc /dev/video0 -vp 0 -cs 320x240 -o test.rm realplay test.rm producer -da -dt -vc /dev/video0 -vp 0 -cs 320x240 -sp `hostname -i`:4040/live.rm realplay rtsp://`hostname -i`/broadcast/live.rm realplay rtsp://`hostname -i`:4040/live.rm realplay rtsp://`hostname -i`:4040/broadcast/live.rm producer -da -dt -vc /dev/video0 -vp 0 -cs 320x240 -si `hostname -i`:3001/live.rm realplay rtsp://`hostname -i`:3001/live.rm tcp 0 0 255.255.255.254:3000 0.0.0.0:* LISTEN udp 0 0 255.255.255.254:3000 0.0.0.0:* producer -da -dt -vc /dev/video0 -vp 0 -cs 320x240 -sg `hostname -i`:3001/live.rm realplay rtsp://`hostname -i`:3001/live.rm producer -da -dt -vc /dev/video0 -vp 0 -cs 320x240 -sd "demo:demo@myserver,live.rm" If you would like to find updates in the future, they will probably be placed at this web-page: http://home.mag.cx/messenger/ /Christian Email: mag@mag.cx ------------------ How to compile and use.... Just run "make install" should work. > make install (load usb modules if not already loaded) > modprobe videodev > modprobe quickcam xawtv -c /dev/video0 You should now get something like this in your syslog file: quickcam: QuickCam USB camera found (driver version QuickCam Messenger/Communicate USB $Date: 2004/12/21 10:00:00 $) quickcam: Kernel:2.6.9-1.667smp bus:4 class:FF subclass:FF vendor:046D product:08F0 quickcam [54.599250]: poisoning qc in qc_usb_init quickcam [54.606150]: E00A contains 08F0 quickcam [55.380589]: Quickcam snapshot button registered as /dev/input/event2 quickcam: Sensor VV6450 detectedxawtv -c /dev/video0 quickcam: Registered device: /dev/video0 usbcore: registered new driver quickcam -------------------- How do I use Camera button? The button events are showed in /proc/video/quickcam/button0 and I recently added the button as an input device too. (I don't have much experience of this) If your kernel supports input devices, then you should be able to do a quick test of the input device... >modprobe input >modprobe evdev >modprobe quickcam On my Fedora Core 3 with kernel 2.6.9, I find the device registered in the file: >cat /proc/bus/input/devices (where you find which eventX the button have) On my Fedora Core 1 with kernel 2.4.22, no such device list exists? I'm writing the device name to the syslog, so read it there until I create an ioctl to return the input device. Anyway, you can try to read the event-device with my test-application ./input_read /dev/input/event2
make install no funciona, però em sembla que he d'aplicar el parxe. Llegir http://www.facilware.com/es/logitech-quickcam-messenger-plus-en-gnulinux.html
el meu kernel és el 2.6.28-11-generic
sudo ./quickcam.sh LINUX_DIR=/usr/src/linux-headers-2.6.28-11-generic cd /usr/src/linux-headers-2.6.28-11-generic make oldconfig && make prepare Kernel source is "2.6.28.9" but running kernel is "2.6.28-11-generic". You may need to do "make bzImage" to correct this error (...)
en executar ./quickcam.sh m'ha donat errors i tiro pel dret, endavant, endavant,... i al final se m'obre una finestra i m'apareix el video de la webcam (!)
$ xawtv -c /dev/video0 $ recordmydesktop -channels 2 -freq 48000 -device hw:0 -delay 3 -fps 25 --overwrite -o barreja.ogv
no em cal utilitzar l'opicó -noxv com en el cas de la Creative. La resolució no és cap meravella, però la gravació és molt més estable que el que he aconseguit amb la Creative (que és una webcam més nova i més fashion). El resultat és més que acceptable, i els colors (amb llum de bombetes) bastant bé.
Nota. El que ha passat és que segurament el driver que està funcionant i que va bé és el que he instal.lat per a la Creative: ov51x-jpeg-source module-assistant
Nota. Amb llum artificial, a la nit, funciona bé. Però amb llum de dia, a la galeria, funciona fatal
Amb cheese veig que té una resolució de 320, i em deixa canviar-la a una resolució encara més baixa. Amb xawtv aquesta funcionalitat no la tinc.
Creative VF0260
L'altra càmera que em deixa provar el Rob és una Creative: (model VF0260)
$ lsusb ... Bus 005 Device 005: ID 041e:4052 Creative Technology, Ltd Live! Cam Vista IM ... $ lsusb -v ... Bus 005 Device 002: ID 041e:4052 Creative Technology, Ltd Live! Cam Vista IM ... idVendor 0x041e Creative Technology, Ltd idProduct 0x4052 Live! Cam Vista IM ...
llista de webcams de Creative compatibles open source: http://opensource.creative.com/webcam.html
- http://www.linuxespanol.com/viewtopic.php?t=21674&sid=b42db78d07213590abf1bf19d6abdb07
- http://www.kernel.org/doc/Documentation/video4linux/gspca.txt -> llista de webcams compatibles
- http://www.ubuntu-es.org/index.php?q=node/25403
$ sudo apt-get install ov51x-jpeg-source module-assistant
crec que funciona. Instal.lo un client per provar-la
$ sudo apt-get install xawtv ./xawtv -> ja va ./xawtv -c /dev/video0
Veig a la web que les especificacions són: 800x600 Pixels, 15 fps
$ recordmydesktop -channels 2 -freq 48000 -device hw:0 -delay 3 -fps 25 --overwrite -o barreja.ogv no grava el que hi ha dins la finestra!! (amb xawtv)
Solució: utilitzar l'opció -noxv
-xv/-noxv habilita/deshabilita el uso de la extensión Xvideo (para overlay), por defecto está activado. Recurso: xawtv.xvideo (bool). $ ./xawtv -c /dev/video0 -noxv $ recordmydesktop -channels 2 -freq 48000 -device hw:0 -delay 3 -fps 25 --overwrite -o barreja.ogv
a més, no estic content amb com es veu la webcam (teòricament són 800x600)
Al final surt bastant bé, un resultat bastant acceptable però una mica inestable. Segur que la meva màquina, molt justa, no ajuda gens.
$ sudo apt-get install camorama -> no em va
altres programes: Ekiga (programa per fer videoconferències i xats),Skype 2.0,xawtv,kopete (no), camstream (no)
Hercules Dualpix HD720p
El distribuidor és MediaMarket
- http://www.pc-actual.com/Laboratorio/Analisis/Hercules-Dualpix-HD720p
- http://www.xataka.com/perifericos/hercules-dualpix-hd720p-webcam-con-alta-resolucion
Fabricante: Hercules Modelo: Dualpix HD720p Precio: 49.99 € Distribuidor: Media Markt (www.mediamarkt.es) Resolución foto, Píxeles foto: 5 MPx FPS máximo: 30 fps Zoom óptico/digital: 3x Micrófono: Otras características: Cámara web diseñada para portátiles. 5 Megapíxeles de resolución (mediante interpolación). Vídeo a 1.280 x 720 píxeles. Relación de aspecto 16:9. Micrófono incorporado. Autofocus. Reductor de ruido. Posición ajustable. Windows XP, Vista y 7. Linux (probado en Ubuntu 9.10) Valoración producto: 8.3 Valoración calidad / precio: 8.7
"We are sorry for the problem you are having with the Hercules Dualpix HD webcam. Dualpix Exchange is UVC compliant, so it is supported under Linux by standard uvcvideo driver (http://linux-uvc.berlios.de/)
Sembla ser que hi ha problemes amb la Hercules Dualpix HD, encara que algú l'ha fet funcionar. En canvi, la Hercules Dualpix Exchange funciona bé.
Hercules Dualpix Exchange
És la webcam que finalment m'he comprat. De la resolució de 1280x960, res de res. S'arriba a aquesta resolució per software, és a dir, una enganyifa. La resolució natural que s'aconsegueix a Linux és 640x480.
- http://www.hercules.com/es/webcam/bdd/p/21/hercules-dualpix-exchange/
- http://lists.berlios.de/pipermail/linux-uvc-devel/2007-November/002449.html
- http://www.hard-h2o.com/review/webcam/hercules-dualpix-exchange.html -> hi ha explicacions i fotos. Concretament, captures de pantalla del software predeterminat, on mostra que la resolució de video màxima és de 1280x960
La Exchange si que funciona, i la tenen en el MediaMarkt
- Fabricante Hercules
- Modelo Dualpix Exchange
- Resolución máxima (fotografía) 2 Megapixeles (1600x1280)
- Resolución máxima (video) 1,8 Megapixeles (1280 x 960)
- Tipo de sensor CMOS
- Formatos de captura AVI, JPG y BMP
- Zoom 3X digital
- Velocidad continua de disparo Hasta 3 imágenes/segundo
- Requisitos mínimos del sistema (recomendados) Intel Pentium III o AMD Athlon 1,1GHz (Intel Pentium 4 2,8 GHz o equivalente) // 256 MB RAM (512 MB) // 300 MB de espacio en disco // USB 1.1 (2.) // Windows XP/Vista
- Extras Micrófono integrado
- Software Webcam Station Evolution SE
- Travelling Zoom
- Focus manual
- Cable USB 180 cm
- Control de color, contraste, brillo, gamma y nitidez
Tu webcam si deberia funcionar.En la pagina del driver http://linux-uvc.berlios.de/ si aparece tu webcam asi que tiene que funcionar.¿Es la normal o la HD? por que hay aqui hay alguien http://ubuntuforums.org/showthread.php?t=1047050 que tuvo problemas con la HD, pero consiguió hacerla funcionar con cheese y emesene (parecidoo al amsn).Prueba a instalar luvcview a ver que tal.Y muestranos la salida al ejecutar lsusb
Linux 2.6.26 and newer includes the Linux UVC driver natively. You will not need to download the driver sources manually unless you want to test a newer version or help with development.
He instal.lat la última versió els drivers (video4linux) manualment i no s'aconsegueix millorar la resolució de 640x480. He fet la instal.lació a partir de:
$ sudo apt-get install mercurial linux-headers-$(uname -r) build-essential If you have choosen to install Mercurial, the source code for the V4L-DVB kernel modules is available via an Hg tree on LinuxTV using the following command from a console: $ hg clone http://linuxtv.org/hg/v4l-dvb $ cd v4l-dvb $ make This will create a /v4l directory within which the completed *.ko module files will be written. Generally, this step will tend to take a while to complete; being dependent upon both the number of modules being built and your system's processing power. The next step is to install the kernel driver modules by executing: $ sudo make install The command above will prompt you for your root password, and will then copy the *.ko module files you built in the above step into the /lib/modules/[kernel version]/kernel/drivers/media directories. $ cat /proc/modules ... uvcvideo 68812 0 - Live 0xf7cdd000 ... o bé $ lsmod ... videodev 46496 1 uvcvideo v4l1_compat 21636 2 uvcvideo,videodev ... $ ls /dev ... drwxr-xr-x 4 root root 80 2010-03-01 19:34 v4l ... $ ls -l /dev/v4l total 0 drwxr-xr-x 2 root root 60 2010-03-01 19:34 by-id drwxr-xr-x 2 root root 60 2010-03-01 19:34 by-path
Per mirar altres viewers que em poden anar bé:
Les proves que he fet són les següents:
En principi el viewer estàndar que veig que em va millor per al meu propòsit és xawtv:
$ xawtv $ xawtv -d /dev/video0 $ xawtv -d /dev/video0 -noxv
Per grabar amb el recordmydesktop he de fer servir l'opció -noxv. Si no funciona, desconnectar la webcam i tornar-la a connectar:
$ xawtv -d /dev/video0 -noxv $ recordmydesktop -channels 2 -freq 44100 -device hw:0 -delay 3 -fps 25 --overwrite -o barreja.ogv
He de tenir present el tema del audio. La webcam té un micro incorporat que es pot veure en la llista de dispositius d'audio (per exemple, a jack, alsamixer,... ($ ls /proc/asound/). Jo en principi buscaré qualitat a l'hora de grabar audio, per tant no faré servir aquest micro.
Si vull grabar només la finestra de la webcam, necessito saber el id de la finestra. En la finestra del xawtv surt TrueColor o bé ???:
$ xwininfo -display :0 -root -children | grep "???" | awk '{print $1}' 0x440005d
per grabar amb el recordmydesktop només aquesta finestra:
$ xawtv -d /dev/video0 -noxv $ recordmydesktop -channels 2 -freq 44100 -device hw:0 -delay 3 -fps 25 -windowid 0x440005d --overwrite -o barreja.ogv
he d'utilitzar l'opció -noxv del xawtv per tal que realment es grabi la imatge
Pàgina web del driver de UVC, que és el que es fa servir. No l'he hagut d'instal.lar perquè en les versions actuals de Ubuntu ja ve instal.lat.
Més tard l'he instal.lat per si hi havia alguna millora en la resolució, però res.
amb camorama no va: Camorama doesn't support V4L2 so it won't work with the UVC driver.
Your webcam should work with any video software that supports V4L2.
Camorama won't work, but Ekiga should. (és per fer videoconferència)
$ sudo apt-get install ekiga
To test UVC luvcview is recommended
$ sudo apt-get install luvcview $ luvcview -o hola.avi $ luvcview -L luvcview 0.2.4 SDL information: Video driver: x11 A window manager is available Device information: Device path: /dev/video0 /dev/video0 does not support read i/o { pixelformat = 'YUYV', description = 'YUV 4:2:2 (YUYV)' } { discrete: width = 640, height = 480 } Time interval between frame: 1/30, 1/25, 1/20, 1/15, 1/10, 1/5, { discrete: width = 352, height = 288 } Time interval between frame: 1/30, 1/25, 1/20, 1/15, 1/10, 1/5, { discrete: width = 320, height = 240 } Time interval between frame: 1/30, 1/25, 1/20, 1/15, 1/10, 1/5, { discrete: width = 176, height = 144 } Time interval between frame: 1/30, 1/25, 1/20, 1/15, 1/10, 1/5, { discrete: width = 160, height = 120 } Time interval between frame: 1/30, 1/25, 1/20, 1/15, 1/10, 1/5, { pixelformat = 'MJPG', description = 'MJPEG' } { discrete: width = 640, height = 480 } Time interval between frame: 1/30, 1/25, 1/20, 1/15, 1/10, 1/5, { discrete: width = 352, height = 288 } Time interval between frame: 1/30, 1/25, 1/20, 1/15, 1/10, 1/5, { discrete: width = 320, height = 240 } Time interval between frame: 1/30, 1/25, 1/20, 1/15, 1/10, 1/5, { discrete: width = 176, height = 144 } Time interval between frame: 1/30, 1/25, 1/20, 1/15, 1/10, 1/5, { discrete: width = 160, height = 120 } Time interval between frame: 1/30, 1/25, 1/20, 1/15, 1/10, 1/5,
lucview va bé per grabar, però confirma que només puc grabar a 640x480 com a molt.
Una prova interessant és utilitzar ffmpeg directament:
$ ffmpeg -y -f video4linux2 -s 640x480 -r 25 -i /dev/video0 -f out.m4v (és el format MPEG-4) $ ffmpeg -y -f video4linux2 -s 640x480 -r 25 -i /dev/video0 -f mpeg out.mpeg $ ffmpeg -y -f video4linux2 -s 640x480 -r 25 -i /dev/video0 -f avi out.avi
640x480 sembla ser que és la màxima resolució. Si ho intento fer a 800x600:
... [video4linux2 @ 0x97eeac0]The V4L2 driver changed the video from 800x600 to 640x480 ...
ffmeg pot anar bé si vull ficar l'opció de grabar dins d'un script.
Resum
Per grabar video de l'escriptori, on en una finestra vull visualitzar el video de la webcam:
$ xawtv -d /dev/video0 -noxv $ recordmydesktop -channels 2 -freq 44100 -device hw:0 -delay 3 -fps 25 --overwrite -o barreja.ogv
Captures (fotos) de la webcam
$ ffmpeg -f video4linux2 -s 640x480 -i /dev/video0 -ss 0:0:2 -frames 1 /home/joan/out.jpg