0

I use Raspberry Pi 3 with Linux RaspberryPi 4.9.59-v7+ onboard together with Logitech HD Webcam C270. It works quite well, I am able to preview video stream in Qt V4l2 Test Utility, take a photo with ffmpeg using

ffmpeg -f video4linux2 -i /dev/v4l/by-id/usb-046d_0825_A96450F0-video-index0 -vframes 2 ~/Desktop/test%3d.jpeg

or with fswebcam using

fswebcam -r 1280x720 ~/Desktop/image.jpg

However, the only odd (1-3-5-etc) shots are taken. On even (2-4-6-etc) ones it says

[video4linux2,v4l2 @ 0xee55c0] Cannot open video device /dev/v4l/by-id/usb-046d_0825_A96450F0-video-index0: Device or resource busy
/dev/v4l/by-id/usb-046d_0825_A96450F0-video-index0: Device or resource busy

for ffmpeg, and

Trying source module v4l2...
Error opening device: /dev/video0
open: Device or resource busy

for fswebcam.

Why does it happen? I have tried reboot, USB disconnect/connect. It also seems that power delivery is enough, since I use original Raspberry power adapter and can view stable stream on full resolution.

Maybe I can force to close all connections to device after each use?

  • It means that frame 1 is still being read (device busy) by the time your timer triggers and an attempt to collect frame2 is made. I bet if you reduce the collection rate you will get all samples. This means the system is heavily loaded or the camera is slow to respond. In either case it's an io latency issue since the error means that someone has the device open still – crasic Mar 15 '18 at 21:30
  • One possibility is that your utiliites do not close the device until after writing output. You may try to write to ramdisk or use a faster SD card to see if this is the case – crasic Mar 15 '18 at 21:35
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.

  • If your previous answer was deleted its a good indication something was wrong with it, instead of posting the same exact answer, look at what previous criticism there was on your previous answer. You will also find this page in the Help Center of use. Now you can improve your current answer. – Darth Vader Mar 20 '18 at 11:55
  • My previous answer was completely different to thew new one. I first tried to edit my old answer and get it undeleted (without success), that's why they now look the same. – palto Mar 21 '18 at 13:43

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.