¿Existe un capturador de imágenes de cámara web CLI que funcione con un dispositivo video4linux2?


8

He intentado todo en

apt-cache search webcam |sort -u

Y todo tiene algún problema. Corregir cualquier error de sintaxis, que muestre cómo usar una "GUI solamente" de la CLI o un buen ffmpeg / mencoder / vlc one-liner respondería a mi pregunta. O dado que sé cómo hacer que ffmpeg tome un MJPEG corto, que muestra cómo quitar el primer jpeg funcionaría, supongo. Aún así, esto debería ser más sencillo que eso.

$ camgrab
/dev/video0: no v4l device

(Camgrab probablemente no maneja v4l2)

$ fswebcam --list-inputs
--- Opening /dev/video0...
Trying source module v4l2...
/dev/video0 opened.
--- Available inputs:
0: Camera 1
No input was specified, using the first.
Adjusting resolution from 384x288 to 352x288.
--- Capturing frame...
Premature end of JPEG file
Captured frame in 0.00 seconds.
--- Processing captured image...
There are unsaved changes to the image.
$ fswebcam --input 0 boo.jpg
--- Opening /dev/video0...
Trying source module v4l2...
/dev/video0 opened.jjjjjjjjj
Adjusting resolution from 384x288 to 352x288.
--- Capturing frame...
Premature end of JPEG file
Captured frame in 0.00 seconds.
--- Processing captured image...
Writing JPEG image to 'boo.jpg'.

produce esto

$ motion

Está más allá de mí.

$ uvccapture -oboo.jpg 
$ file boo.jpg        
boo.jpg: data
$ qiv -t boo.jpg 
Unable to read file: Failed to load image 'boo.jpg': Error interpreting JPEG image file (Not a JPEG file: starts with 0x8f 0x5a)

No es realmente una imagen.

$ /usr/bin/vgrabbj -d /dev/video0 -f boo.jpg
Could not open configfile /usr/etc/vgrabbj.conf, ignoring
Reading image from /dev/video0

produce esto

$ webcamd
RTFM, missing template (/home/$USER/.webcamd/index_up.html)
$ man webcamd |cat
WEBCAMD(1)                                                                     WEBCAMD(1)
NAME
    webcamd - Take a image from your webcam
SYNOPSIS
    webcamd [ start | stop | refresh ]
DESCRIPTION
    This manual page documents briefly the webcamd daemon.
    This manual page was written for the Debian distribution because the original pro‐
    gram does not have a manual page.
    webcamd is a program that take images from your webcam and put it on a ftp  server
    on a local (web) directory
OPTIONS
    start  Start the daemon.
    stop   Stop the daemon.
    refresh Take a shot !
AUTHOR
    This  manual  page  was  written by Julien Danjou <acid@debian.org> for the Debian
    system (but may be used by others).  Permission is  granted  to  copy,  distribute
    and/or modify this document under the terms of the GNU Free Documentation License,
    Version 1.1 or any later version published by the Free Software  Foundation;  with
    no Invariant Sections, no Front-Cover Texts and no Back-Cover Texts.
                                  2002 april 21                            WEBCAMD(1)
$ webcamd start
RTFM, missing template (/home/$USER/.webcamd/index_up.html)
$ webcamd refresh
RTFM, missing template (/home/$USER/.webcamd/index_up.html)

La cámara web parece exigir que configure un archivo de configuración para ftp las imágenes en algún lugar y parece no hacer nada por defecto

$ /usr/bin/webcam 
reading config file: /home/$USER/.webcamrc
video4linux webcam v1.5 - (c) 1998-2002 Gerd Knorr
grabber config:
  size 320x240 [none]
  input (null), norm (null), jpeg quality 75
  rotate=0, top=0, left=0, bottom=240, right=320
  • Solo GUI
    • camorama
    • queso
    • kamoso
    • luvcview

webcamd es una broma Todo lo que hace es esto / usr / bin / v4lctl -c / dev / video0 snap jpeg 160x120 ~ / .webcamd / webcam.jpg Al leer el código, este es el formato de configuración #section common <common> # Interval between disparos (importante o entra en un bucle infinito) inter = 60 www_path = / tmp / www enable_ftp = no webcam_resolution = 320x200 # / dev / está incluido en este dispositivo = video0 #section picture <picture> put_date = no font = arial fontsize = 12 fontcolor = black disp_box = no boxcolor = black border = yes bordercolor = black #section ftp <ftp> host = localhost user = teknopaul port = 999 password = foo directory = / tmp
teknopaul

hmm no puedo entrar en nuevas líneas
teknopaul

Respuestas:


9

Desde aqui

Streamer

Streamer (http://linux.bytesex.org/xawtv/) is a versatile program that allows a
capture from a webcam or video device using only the command line. It may be offered 
in your Linux distribution's Xawtv package. To install streamer try

# sudo apt-get install xawtv

To take a standard JPEG picture from the command line where the camera is accessed 
through /dev/video0:

#streamer -c /dev/video0 -b 16 -o outfile.jpeg

Where > -b is the number of colors (in bpp,whether 15, 16, 24 or 32)
& -o is the output filename in the current directory

If you are going to capture multiple images be sure to append the output file name 
with zeros, as streamer can name the capture files in sequence, i.e., -o 
outfile000.jpeg becomes outfile001.jpeg, outfile002.jpeg, and so on.  

De los comentarios: streamer no está incluido en el paquete xawtv, sudo apt-get install streamer


Streamer se ve bien. Sin embargo, debe obtenerlo por separado; no viene con xawtv automáticamente.
John Baber-Lucero

Es lo único que funciona. Pero el hombre es lento. Se necesitan 1,8 segundos para capturar una imagen.
John Baber-Lucero

1
Pop para chatear si quieres hablar un poco más sobre eso. Mantiene los comentarios
pendientes

3

Lo hice con mplayer hace años, pero no recuerdo exactamente cómo. mplayer tv:// -tv driver=v4l2:input=1:width=352:height=288:device=/dev/video0muestra una transmisión en vivo, pero estoy convencido de que puede guardarla como jpg o png. Consulte la página del manual.


2

Usar fswebcamno con -osino con --save. -ole dice dónde escribir un archivo de registro ...

ejemplo:

fswebcam --save /home/$USER/webcamGrab.jpg -d /dev/video1 -r 1280x960

1

webcamd es una broma, es un script en perl con comentarios en francés.

Todo lo que hace es esto

/usr/bin/v4lctl -c /dev/video0 snap jpeg 160x120 ~/.webcamd/webcam.jpg

en un bucle

Al leer el código, este es el formato de configuración

#section common
<common>
# Interval between shots (important or it enters an infinite loop)
inter=60
www_path=/tmp/www
enable_ftp=no
webcam_resolution=320x200
# /dev/ is prepended on to this
device=video0
#section picture
<picture>
put_date=no
font=arial
fontsize=12
fontcolor=black
disp_box=no 
boxcolor=black
border=yes
bordercolor=black
#section ftp
<ftp>
host=localhost
user=teknopaul
port=999
password=foo
directory=/tmp

Sin embargo, el crédito se debió a los créditos, no habría encontrado la v4lctlbúsqueda de cámara web :)


0

El método de línea de comandos más fácil para tomar una captura de pantalla de una cámara web o dispositivo similar se encuentra usando mplayer:

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

Ahora simplemente presione la tecla 's' y se guardará una captura de pantalla en formato png en su directorio de trabajo.

Si desea que se tomen múltiples capturas de pantalla automáticamente, presione la tecla 'S' para iniciar las capturas de pantalla y presiónelo nuevamente para detener el flujo :)

Referencias

Al usar nuestro sitio, usted reconoce que ha leído y comprende nuestra Política de Cookies y Política de Privacidad.
Licensed under cc by-sa 3.0 with attribution required.