Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I've tried everything in

apt-cache search webcam |sort -u

and everything has some problem. Correcting any syntax mistakes, showing how to use a "GUI only" from the CLI or a good ffmpeg/mencoder/vlc one-liner would answer my question. Or since I know how to make ffmpeg take a short MJPEG, showing how to strip off the first jpeg would work, I guess. Still, this ought to be more straightforward than that.

$ camgrab
/dev/video0: no v4l device

(camgrab probably doesn't handle 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'.

produces this

$ motion

is beyond me.

$ 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)

not really an image.

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

produces this

$ 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)

webcam seems to demand that I set a config file to ftp the images somewhere and seems to do nothing by default

$ /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
  • GUI only
    • camorama
    • cheese
    • kamoso
    • luvcview
share|improve this question

4 Answers 4

up vote 6 down vote accepted

From here

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.  

From comments: streamer is not included in the xawtv package, sudo apt-get install streamer

share|improve this answer
    
Streamer looks good. You have to apt-get it separately though; it doesn't come with xawtv automatically. –  John Baber Apr 17 '12 at 18:49
    
Thanks, I'll add that to the answer –  hbdgaf Apr 17 '12 at 18:51
    
It's the only thing that works. But man is it slow. It takes 1.8 seconds to grab an image. –  John Baber Apr 17 '12 at 19:37
1  
Pop in to chat if you want to talk about it some more. Keeps the run-on comments down –  hbdgaf Apr 17 '12 at 19:40

I've done it with mplayer years ago, but can't remember exactly how. mplayer tv:// -tv driver=v4l2:input=1:width=352:height=288:device=/dev/video0 shows a live feed, but I'm convinced you can save it as jpg or png. Check the manual page.

share|improve this answer

Use fswebcam not with -o but with --save. -o tells where to write a logfile ...

example:

fswebcam --save /home/$USER/webcamGrab.jpg -d /dev/video1 -r 1280x960
share|improve this answer

webcamd is awful. Stale, old, useless.

motion is pretty good. loads of options. good documentation.

http://www.lavrsen.dk/foswiki/bin/view/Motion/MotionGuide

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.