1

I want to periodically take pictures using a webcam connected on a Raspberry Pi via fswebcam. It happens that it is unstable and some times it just fails, with no apparently reason.

Below you will see a console session where I repeatedly run the same command to get a picture. I do it 6 times:

  1. Success
  2. Fails with the message "VIDIOC_DQBUF: No such device"
  3. Fails with the message "stat: No such file or directory"
  4. Fails with the message "VIDIOC_QBUF: No such device"
  5. Fails with the message "VIDIOC_QBUF: No such device"
  6. Success

    pi@rodrigo:~/rodrigo $ /usr/bin/fswebcam -S 1 --no-banner deleteme.png
    --- Opening /dev/video0...
    Trying source module v4l2...
    /dev/video0 opened.
    No input was specified, using the first.
    Adjusting resolution from 384x288 to 640x480.
    --- Capturing frame...
    Skipping frame...
    Capturing 1 frames...
    Captured 2 frames in 0.04 seconds.
    --- Processing captured image...
    Disabling banner.
    Writing JPEG image to 'deleteme.png'.
    pi@rodrigo:~/rodrigo $ /usr/bin/fswebcam -S 1 --no-banner deleteme.png
    --- Opening /dev/video0...
    Trying source module v4l2...
    /dev/video0 opened.
    No input was specified, using the first.
    Adjusting resolution from 384x288 to 640x480.
    --- Capturing frame...
    Skipping frame...
    VIDIOC_DQBUF: No such device
    Capturing 1 frames...
    VIDIOC_DQBUF: No such device
    No frames captured.
    pi@rodrigo:~/rodrigo $ /usr/bin/fswebcam -S 1 --no-banner deleteme.png
    --- Opening /dev/video0...
    stat: No such file or directory
    pi@rodrigo:~/rodrigo $ /usr/bin/fswebcam -S 1 --no-banner deleteme.png
    --- Opening /dev/video0...
    Trying source module v4l2...
    /dev/video0 opened.
    No input was specified, using the first.
    Adjusting resolution from 384x288 to 640x480.
    --- Capturing frame...
    Skipping frame...
    Capturing 1 frames...
    VIDIOC_QBUF: No such device
    Captured frame in 0.00 seconds.
    No frames captured.
    pi@rodrigo:~/rodrigo $ /usr/bin/fswebcam -S 1 --no-banner deleteme.png
    --- Opening /dev/video0...
    Trying source module v4l2...
    /dev/video0 opened.
    No input was specified, using the first.
    Adjusting resolution from 384x288 to 640x480.
    --- Capturing frame...
    Skipping frame...
    VIDIOC_DQBUF: No such device
    Capturing 1 frames...
    VIDIOC_DQBUF: No such device
    No frames captured.
    pi@rodrigo:~/rodrigo $ /usr/bin/fswebcam -S 1 --no-banner deleteme.png
    --- Opening /dev/video0...
    Trying source module v4l2...
    /dev/video0 opened.
    No input was specified, using the first.
    Adjusting resolution from 384x288 to 640x480.
    --- Capturing frame...
    Skipping frame...
    Capturing 1 frames...
    Captured 2 frames in 0.03 seconds.
    --- Processing captured image...
    Disabling banner.
    Writing JPEG image to 'deleteme.png'.
    pi@rodrigo:~/rodrigo $ 
    

I tried two different cameras I have here. Same result. Any ideas?

Tks for your help!

  • How are you powering the Pi? What model Pi do you have? – Steve Robillard Jul 8 '17 at 18:14
  • I am using a DC-DC conversor from 12VCD to 5VCD (3A). I am using a model Raspberry-Pi 3 Model B. – Chocksmith Jul 8 '17 at 19:15
  • Have you measured the voltage at the board (5v and ground pins - note be very careful as this can damage the board or pins if you short the 5v pin)? Ideally, you would do this while taking a photo. It might also be worth the time to try a powered USB hub to help eliminate a power issue. – Steve Robillard Jul 8 '17 at 19:33
  • You will probably get better, stable,results by starting fswebcam once only and having it continually take a frame using -l interval. Also look in the console log for any messages for the device. – meuh Jul 9 '17 at 16:05
  • @SteveRobillard I will measure and get back to you. – Chocksmith Jul 9 '17 at 18:09
1

Sorry for the delay posting this answer. As suggested by @SteveRobillard I've measured the voltage at the board while taking a photo and everything was OK.

Using SIGUSR1 as suggested by @meuh did not help because it just wake up the webcam and ultimately it still needs few seconds to auto stabilize the exposure.

In the end of the day, what solved my problem was: changing the USB cable!

I hope that this post helps someone in the future: check cables!

Thank guys.

0

I had the same issue with my Logitech C905 and was nearly giving up, but then I found the solution in a post on the raspberrypi.org forum :) https://www.raspberrypi.org/forums/viewtopic.php?f=28&t=197089

The problem was fixed for my by adding the extra command dwc_otg.fiq_fsm_mask=0x3 in the file /boot/cmdline.txt.

The reason why I didn't find it earlier was that the post was about issues with ffmpeg and not fswebcam, but root cause seems to be the same.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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