Gomoto
Posts: 106
Joined: Tue Feb 12, 2013 1:21 am

OpenCV v4l2 select timeout error SOLVED! High FPS!

Sat Mar 02, 2013 12:49 pm

Trouble with capturing video from your webcam?

While capturing frames with your program or any other software (capturing via the v4l2 kernel module), you recieve select timeout errors and the process is terminated?

Do not despair:

I read about first pointers in this thread (identifying v4l2 uvcvideo kernel module as a steppingstone to the solution)

http://www.raspberrypi.org/phpBB3/viewt ... 37&t=11745

The proposed steps
lsmod
rmmod uvcvideo
modprobe uvcvideo nodrop=1 timeout=5000
improved the situation but did not prevent the select timeout errors.

I looked at the uvcvideo faq and read about the quirks for problem devices. The timeout problems seems related to the bandwidth. So now I use the additional uvcvideo option quirks=0x80 (bandwidth quirk). Further there is the program guvcview available with apt-get install, a desktop tool to set the capture options of your webcam. I turned off all automatic image processing options, i want to process the feed myself anyway.

No more timeout select errors and 15 FPS at 55% CPU (prior 3-5 FPS)! Significant less CPU usage at the reduced FPS I am aiming for (20% CPU at 5 FPS).

That way I am able to use my Logitech C120 webcam with the raspberry pi and opencv. I am really impressed what can be achieved with this 25$ device using 100 times less power and 20 times less money. I was haunted by the select timeout errors also on my 4 Mhz quad core box, but finally got rid of this using this phenomenal energy saving computational device!

No more timeout select crash with this shell script (and guvcview for the settings):

Code: Select all

/#bin/bash
rmmod uvcvideo
modprobe uvcvideo nodrop=1 timeout=5000 quirks=0x80

Gomoto
Posts: 106
Joined: Tue Feb 12, 2013 1:21 am

Re: OpenCV v4l2 select timeout error SOLVED! High FPS!

Fri Mar 08, 2013 12:46 pm

Additional Info: My webcam only works on an internal usb port. It produces errors on the hub.

jtmitchu
Posts: 1
Joined: Fri Mar 08, 2013 2:09 pm

Re: OpenCV v4l2 select timeout error SOLVED! High FPS!

Fri Mar 08, 2013 2:11 pm

What OS are you using?

I'm using Arch Linux ARM and I am not able to get the C120 to operate - I just get the timeouts - even with the dropout set (though I haven't tried quirks mode).

Gomoto
Posts: 106
Joined: Tue Feb 12, 2013 1:21 am

Re: OpenCV v4l2 select timeout error SOLVED! High FPS!

Fri Mar 08, 2013 7:52 pm

I am using raspian, try the quirk. Should be working on Arch as well.

Sancho
Posts: 9
Joined: Sun Nov 13, 2011 8:32 am

Re: OpenCV v4l2 select timeout error SOLVED! High FPS!

Wed Mar 20, 2013 10:58 pm

Hello.
I am using latest raspbian (kernel 3.6.11+ #393).
The module parameters do not help - the framerate is initially better, but after 5 log records "uvcvideo: Non-zero status (-5) in video completion handler.", the mjpg_streamer stops working and that's it.
The same applies to motion - if I configure it to use /dev/video0 directly, after 5 log records mentioned the motion kills the thread as unresponsive.

Gomoto
Posts: 106
Joined: Tue Feb 12, 2013 1:21 am

Re: OpenCV v4l2 select timeout error SOLVED! High FPS!

Thu Mar 21, 2013 1:04 pm

I have no mjpg_streamer lock ups when I use the script and the -y switch (YUV) on the input plugin.

Mndr
Posts: 3
Joined: Mon Nov 09, 2015 5:45 pm

Re: OpenCV v4l2 select timeout error SOLVED! High FPS!

Tue Nov 10, 2015 1:58 pm

hello gogmoto
i have few problems with setting up guvcview apparently it doesn't run and the error message it this

Code: Select all

GUVCVIEW: couldn't open /home/pi/.config/guvcview2/video0 for read: No such file or directory
V4L2_CORE: (UVCIOC_CTRL_MAP) Error: Inappropriate ioctl for device
V4L2_CORE: (UVCIOC_CTRL_MAP) Error: Inappropriate ioctl for device
V4L2_CORE: (UVCIOC_CTRL_MAP) Error: Inappropriate ioctl for device
V4L2_CORE: (UVCIOC_CTRL_MAP) Error: Inappropriate ioctl for device
V4L2_CORE: (UVCIOC_CTRL_MAP) Error: Inappropriate ioctl for device
V4L2_CORE: (UVCIOC_CTRL_MAP) Error: Inappropriate ioctl for device
V4L2_CORE: (UVCIOC_CTRL_MAP) Error: Inappropriate ioctl for device
V4L2_CORE: (UVCIOC_CTRL_MAP) Error: Inappropriate ioctl for device
V4L2_CORE: (UVCIOC_CTRL_MAP) Error: Inappropriate ioctl for device
ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.front
ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.rear
ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.center_lfe
ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.side
ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.surround21
ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.surround21
ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.surround40
ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.surround41
ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.surround50
ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.surround51
ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.surround71
ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.iec958
ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.iec958
ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.iec958
ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.hdmi
ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.hdmi
ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.modem
ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.modem
ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.phoneline
ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.phoneline
Cannot connect to server socket err = No such file or directory
Cannot connect to server request channel
jack server is not running or cannot be started
Segmentation fault
i have a logitech 4000 and it is indexed in lsusb

Return to “Troubleshooting”

Who is online

Users browsing this forum: Google [Bot], raspi-owner, Term2, THon and 58 guests