GNOME Bugzilla – Bug 503503
v4l2src Could not get buffers from device '/dev/video0'
Last modified: 2008-02-02 17:53:08 UTC
Please describe the problem: I cannot use cheese with my v4l2 UVC camera because I get the error: Could not get buffers from device '/dev/video0' in detection. This is a bug in gstreamer-plugins-good and will aparently be fixed in version 10.7. However, I can get my camera to work in gstreamer by doing the following command: gst-launch-0.10 v4l2src queue-size=2 ! ffmpegcolorspace ! ximagesink So, I changed the Default input entry in gstreamer-properties to 'v4l2src queue-size=2' but cheese still fails - it seems to just ignore the changes I made to gstreamer-properties. Shouldn't cheese use these settings? Steps to reproduce: 1. Buy UVC camera 2. Plug into your computer with gstreamer-plugins-good-10.6 3. Notice that cheese doesn't work Actual results: Cheese doesn't not detect and cameras. Expected results: For it to detect my UVC camera Does this happen every time? yep Other information:
I think this has been fixed in cheese SVN and gstreamer 0.10.15. Can you try the version from SVN?
Created attachment 100990 [details] bug report
Well. I gave it a try but the version of cheese in svn crashes on me immediately everytime I try to run it. I attached the bug report.
Thanks, the bug report is not that helpful though. It seems that not all debug symbols are there. Can you run cheese in gdb to see where it crashes.
The output of running cheese in gdb is : Starting program: /usr/local/bin/cheese warning: Missing the separate debug info file: /usr/lib/debug/.build-id/ac/2eeb206486bb7315d6ac4cd64de0cb50838ff6.debug (Then about 50 more of lines similar to the last one) warning: Missing the separate debug info file: /usr/lib/debug/.build-id/75/264b0eb027ad1d0566dd0dfd86902d57aea9ef.debug [New Thread -1287648368 (LWP 32254)] [New Thread -1300235376 (LWP 32255)] Program received signal SIGSEGV, Segmentation fault. [Switching to Thread -1208506080 (LWP 32250)] cheese_webcam_init (webcam=0x85d5d70) at cheese-webcam.c:591 591 for (i = 0; i < format->num_framerates; i++) I am not sure if this will be useful to you.
It's pretty useful. I think the problem is that format is NULL somehow because we don't read your camera properties correctly. What's the terminal output you get when you run cheese in a terminal?
The only terminal output from running cheese is about 50 lines similar to the following: warning: Missing the separate debug info file: /usr/lib/debug/.build-id/3b/fcf3e37731d5058d14badc687008e09c95cb1b.debug Nothing else seems to be outputted.
Very weird. Can you step through the code starting at cheese_webcam_detect_webcam_devices gdb cheese break cheese_webcam_detect_webcam_devices run and then step through the code to see what happens Thanks
Well, I have to admit that I have no idea what I am doing but this is what I did and what happenned: gdb cheese GNU gdb Red Hat Linux (6.6-36.fc8rh) Copyright (C) 2006 Free Software Foundation, Inc. GDB is free software, covered by the GNU General Public License, and you are welcome to change it and/or distribute copies of it under certain conditions. Type "show copying" to see the conditions. There is absolutely no warranty for GDB. Type "show warranty" for details. This GDB was configured as "i386-redhat-linux-gnu"... Using host libthread_db library "/lib/libthread_db.so.1". (gdb) break cheese_webcam_detect_webcam_devices Function "cheese_webcam_detect_webcam_devices" not defined. Make breakpoint pending on future shared library load? (y or [n]) y Breakpoint 1 (cheese_webcam_detect_webcam_devices) pending. (gdb) run Starting program: /usr/local/bin/cheese warning: Missing the separate debug info file: /usr/lib/debug/.build-id/ac/2eeb206486bb7315d6ac4cd64de0cb50838ff6.debug (then about 50 more messages like the last one) [Thread debugging using libthread_db enabled] [New process 6336] (then about 50 more messages about the missing debug info file [New Thread -1208903392 (LWP 6336)] (more messages about debug info files) [Detaching after fork from child process 6340. (Try `set detach-on-fork off'.)] [New Thread -1288139888 (LWP 6341)] [New Thread -1298629744 (LWP 6342)] Program received signal SIGSEGV, Segmentation fault. [Switching to Thread -1208903392 (LWP 6336)] cheese_webcam_init (webcam=0x850e170) at cheese-webcam.c:591 591 for (i = 0; i < format->num_framerates; i++) I am pretty sure this is not what you intended me to do since I didn't 'step through anything' ...
Also I just tried to do svn update on the cheese directory. Now I can't seem to compile it - I get this error: make all-recursive make[1]: Entering directory `/home/jdeslip/Progs/cheese' Making all in src make[2]: Entering directory `/home/jdeslip/Progs/cheese/src' gcc -DHAVE_CONFIG_H -I. -I.. -DBINDIR=\"/usr/local/bin\" -DDATADIR=\"/usr/local/share\" -DPREFIX=\""/usr/local"\" -DSYSCONFDIR=\""/usr/local/etc"\" -DLIBDIR=\""/usr/local/lib"\" -DPACKAGE_DATADIR=\""/usr/local/share/cheese"\" -DPACKAGE_LOCALEDIR=\""/usr/local/share/locale"\" -DORBIT2=1 -pthread -DDBUS_API_SUBJECT_TO_CHANGE -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/include/gtk-2.0 -I/usr/lib/gtk-2.0/include -I/usr/include/atk-1.0 -I/usr/include/cairo -I/usr/include/pango-1.0 -I/usr/include/libgnomeui-2.0 -I/usr/include/libgnome-2.0 -I/usr/include/libbonoboui-2.0 -I/usr/include/libgnomecanvas-2.0 -I/usr/include/gnome-vfs-2.0 -I/usr/lib/gnome-vfs-2.0/include -I/usr/include/libbonobo-2.0 -I/usr/include/orbit-2.0 -I/usr/include/bonobo-activation-2.0 -I/usr/include/libart-2.0 -I/usr/include/gconf/2 -I/usr/include/libglade-2.0 -I/usr/include/libxml2 -I/usr/include/gstreamer-0.10 -I/usr/include/evolution-data-server-1.12 -I/usr/include/dbus-1.0 -I/usr/lib/dbus-1.0/include -I/usr/include/hal -g -O2 -Wall -Werror -MT cheese-webcam.o -MD -MP -MF .deps/cheese-webcam.Tpo -c -o cheese-webcam.o cheese-webcam.c cc1: warnings being treated as errors cheese-webcam.c: In function ‘cheese_webcam_create_webcam_source_bin’: cheese-webcam.c:583: warning: implicit declaration of function ‘strcmp’ make[2]: *** [cheese-webcam.o] Error 1 make[2]: Leaving directory `/home/jdeslip/Progs/cheese/src' make[1]: *** [all-recursive] Error 1 make[1]: Leaving directory `/home/jdeslip/Progs/cheese' make: *** [all] Error 2 Perhaps this is related to why it wasn't working before...
sorry, my fault. please try again!
Ok, I can now compile cheese again. But, I am now back to the old problem where cheese immediately crashes.
are you shure, that you are using gstreamer 0.10.15
He probably is using the newest gstreamer otherwise configure would fail jdeslip can debug cheese with gdb You can find a tutorial about gdb here http://www.unknownroad.com/rtfm/gdbtut/gdbtoc.html As I said you do gdb cheese break cheese_webcam_detect_webcam_devices run and then use "step" or "next" and print variables to see what's wrong
Created attachment 101350 [details] Python script to check camera Another way to help is running this python script and paste the output overhere
Sorry for the delay. I went on holidays to my parents place. I will try running this when I get back (in 5 days)
ok, I am probably being a complete idiot but I can't get gdb to output anything usefull - right after I type the "run" line into the gdb command line cheese just spits out the 50 or so warnings about "Missing separate debug files" and then it says program received signal SIGSEGV. What else can I do? Here is the about from running 'python detect.py' - This is in the 3.0 release of cheese. [jdeslip@jdeslippe ~]$ python detect.py <?xml version="1.0" encoding="UTF-8"?> <!-- -*- xml -*- --> <deviceinfo version="0.2"> <device> <match key="unknown" int="0"> <match key="usb" int="0"> <merge key="gstreamer.source" type="string">v4l2src</merge> <merge key="info.product" type="string">UVC Camera (046d:08c9)</merge> <append key="gstreamer.capabilities" type="strlist">image/jpeg, width=(int)640, height=(int)480, framerate=(fraction)30/1</append> <append key="gstreamer.capabilities" type="strlist">image/jpeg, width=(int)640, height=(int)480, framerate=(fraction)25/1</append> <append key="gstreamer.capabilities" type="strlist">image/jpeg, width=(int)640, height=(int)480, framerate=(fraction)20/1</append> <append key="gstreamer.capabilities" type="strlist">image/jpeg, width=(int)640, height=(int)480, framerate=(fraction)15/1</append> <append key="gstreamer.capabilities" type="strlist">image/jpeg, width=(int)640, height=(int)480, framerate=(fraction)10/1</append> <append key="gstreamer.capabilities" type="strlist">image/jpeg, width=(int)640, height=(int)480, framerate=(fraction)5/1</append> <append key="gstreamer.capabilities" type="strlist">video/x-raw-yuv, width=(int)640, height=(int)480, framerate=(fraction)30/1, format=(fourcc)YUY2</append> <append key="gstreamer.capabilities" type="strlist">video/x-raw-yuv, width=(int)640, height=(int)480, framerate=(fraction)25/1, format=(fourcc)YUY2</append> <append key="gstreamer.capabilities" type="strlist">video/x-raw-yuv, width=(int)640, height=(int)480, framerate=(fraction)20/1, format=(fourcc)YUY2</append> <append key="gstreamer.capabilities" type="strlist">video/x-raw-yuv, width=(int)640, height=(int)480, framerate=(fraction)15/1, format=(fourcc)YUY2</append> <append key="gstreamer.capabilities" type="strlist">video/x-raw-yuv, width=(int)640, height=(int)480, framerate=(fraction)10/1, format=(fourcc)YUY2</append> <append key="gstreamer.capabilities" type="strlist">video/x-raw-yuv, width=(int)640, height=(int)480, framerate=(fraction)5/1, format=(fourcc)YUY2</append> <append key="gstreamer.capabilities" type="strlist">image/jpeg, width=(int)160, height=(int)120, framerate=(fraction)30/1</append> <append key="gstreamer.capabilities" type="strlist">image/jpeg, width=(int)160, height=(int)120, framerate=(fraction)25/1</append> <append key="gstreamer.capabilities" type="strlist">image/jpeg, width=(int)160, height=(int)120, framerate=(fraction)20/1</append> <append key="gstreamer.capabilities" type="strlist">image/jpeg, width=(int)160, height=(int)120, framerate=(fraction)15/1</append> <append key="gstreamer.capabilities" type="strlist">image/jpeg, width=(int)160, height=(int)120, framerate=(fraction)10/1</append> <append key="gstreamer.capabilities" type="strlist">image/jpeg, width=(int)160, height=(int)120, framerate=(fraction)5/1</append> <append key="gstreamer.capabilities" type="strlist">video/x-raw-yuv, width=(int)160, height=(int)120, framerate=(fraction)30/1, format=(fourcc)YUY2</append> <append key="gstreamer.capabilities" type="strlist">video/x-raw-yuv, width=(int)160, height=(int)120, framerate=(fraction)25/1, format=(fourcc)YUY2</append> <append key="gstreamer.capabilities" type="strlist">video/x-raw-yuv, width=(int)160, height=(int)120, framerate=(fraction)20/1, format=(fourcc)YUY2</append> <append key="gstreamer.capabilities" type="strlist">video/x-raw-yuv, width=(int)160, height=(int)120, framerate=(fraction)15/1, format=(fourcc)YUY2</append> <append key="gstreamer.capabilities" type="strlist">video/x-raw-yuv, width=(int)160, height=(int)120, framerate=(fraction)10/1, format=(fourcc)YUY2</append> <append key="gstreamer.capabilities" type="strlist">video/x-raw-yuv, width=(int)160, height=(int)120, framerate=(fraction)5/1, format=(fourcc)YUY2</append> <append key="gstreamer.capabilities" type="strlist">image/jpeg, width=(int)176, height=(int)144, framerate=(fraction)30/1</append> <append key="gstreamer.capabilities" type="strlist">image/jpeg, width=(int)176, height=(int)144, framerate=(fraction)25/1</append> <append key="gstreamer.capabilities" type="strlist">image/jpeg, width=(int)176, height=(int)144, framerate=(fraction)20/1</append> <append key="gstreamer.capabilities" type="strlist">image/jpeg, width=(int)176, height=(int)144, framerate=(fraction)15/1</append> <append key="gstreamer.capabilities" type="strlist">image/jpeg, width=(int)176, height=(int)144, framerate=(fraction)10/1</append> <append key="gstreamer.capabilities" type="strlist">image/jpeg, width=(int)176, height=(int)144, framerate=(fraction)5/1</append> <append key="gstreamer.capabilities" type="strlist">video/x-raw-yuv, width=(int)176, height=(int)144, framerate=(fraction)30/1, format=(fourcc)YUY2</append> <append key="gstreamer.capabilities" type="strlist">video/x-raw-yuv, width=(int)176, height=(int)144, framerate=(fraction)25/1, format=(fourcc)YUY2</append> <append key="gstreamer.capabilities" type="strlist">video/x-raw-yuv, width=(int)176, height=(int)144, framerate=(fraction)20/1, format=(fourcc)YUY2</append> <append key="gstreamer.capabilities" type="strlist">video/x-raw-yuv, width=(int)176, height=(int)144, framerate=(fraction)15/1, format=(fourcc)YUY2</append> <append key="gstreamer.capabilities" type="strlist">video/x-raw-yuv, width=(int)176, height=(int)144, framerate=(fraction)10/1, format=(fourcc)YUY2</append> <append key="gstreamer.capabilities" type="strlist">video/x-raw-yuv, width=(int)176, height=(int)144, framerate=(fraction)5/1, format=(fourcc)YUY2</append> <append key="gstreamer.capabilities" type="strlist">image/jpeg, width=(int)320, height=(int)240, framerate=(fraction)30/1</append> <append key="gstreamer.capabilities" type="strlist">image/jpeg, width=(int)320, height=(int)240, framerate=(fraction)25/1</append> <append key="gstreamer.capabilities" type="strlist">image/jpeg, width=(int)320, height=(int)240, framerate=(fraction)20/1</append> <append key="gstreamer.capabilities" type="strlist">image/jpeg, width=(int)320, height=(int)240, framerate=(fraction)15/1</append> <append key="gstreamer.capabilities" type="strlist">image/jpeg, width=(int)320, height=(int)240, framerate=(fraction)10/1</append> <append key="gstreamer.capabilities" type="strlist">image/jpeg, width=(int)320, height=(int)240, framerate=(fraction)5/1</append> <append key="gstreamer.capabilities" type="strlist">video/x-raw-yuv, width=(int)320, height=(int)240, framerate=(fraction)30/1, format=(fourcc)YUY2</append> <append key="gstreamer.capabilities" type="strlist">video/x-raw-yuv, width=(int)320, height=(int)240, framerate=(fraction)25/1, format=(fourcc)YUY2</append> <append key="gstreamer.capabilities" type="strlist">video/x-raw-yuv, width=(int)320, height=(int)240, framerate=(fraction)20/1, format=(fourcc)YUY2</append> <append key="gstreamer.capabilities" type="strlist">video/x-raw-yuv, width=(int)320, height=(int)240, framerate=(fraction)15/1, format=(fourcc)YUY2</append> <append key="gstreamer.capabilities" type="strlist">video/x-raw-yuv, width=(int)320, height=(int)240, framerate=(fraction)10/1, format=(fourcc)YUY2</append> <append key="gstreamer.capabilities" type="strlist">video/x-raw-yuv, width=(int)320, height=(int)240, framerate=(fraction)5/1, format=(fourcc)YUY2</append> <append key="gstreamer.capabilities" type="strlist">image/jpeg, width=(int)960, height=(int)720, framerate=(fraction)15/1</append> <append key="gstreamer.capabilities" type="strlist">image/jpeg, width=(int)960, height=(int)720, framerate=(fraction)10/1</append> <append key="gstreamer.capabilities" type="strlist">image/jpeg, width=(int)960, height=(int)720, framerate=(fraction)5/1</append> <append key="gstreamer.capabilities" type="strlist">video/x-raw-yuv, width=(int)960, height=(int)720, framerate=(fraction)10/1, format=(fourcc)YUY2</append> <append key="gstreamer.capabilities" type="strlist">video/x-raw-yuv, width=(int)960, height=(int)720, framerate=(fraction)5/1, format=(fourcc)YUY2</append> <append key="gstreamer.capabilities" type="strlist">image/jpeg, width=(int)352, height=(int)288, framerate=(fraction)30/1</append> <append key="gstreamer.capabilities" type="strlist">image/jpeg, width=(int)352, height=(int)288, framerate=(fraction)25/1</append> <append key="gstreamer.capabilities" type="strlist">image/jpeg, width=(int)352, height=(int)288, framerate=(fraction)20/1</append> <append key="gstreamer.capabilities" type="strlist">image/jpeg, width=(int)352, height=(int)288, framerate=(fraction)15/1</append> <append key="gstreamer.capabilities" type="strlist">image/jpeg, width=(int)352, height=(int)288, framerate=(fraction)10/1</append> <append key="gstreamer.capabilities" type="strlist">image/jpeg, width=(int)352, height=(int)288, framerate=(fraction)5/1</append> <append key="gstreamer.capabilities" type="strlist">video/x-raw-yuv, width=(int)352, height=(int)288, framerate=(fraction)30/1, format=(fourcc)YUY2</append> <append key="gstreamer.capabilities" type="strlist">video/x-raw-yuv, width=(int)352, height=(int)288, framerate=(fraction)25/1, format=(fourcc)YUY2</append> <append key="gstreamer.capabilities" type="strlist">video/x-raw-yuv, width=(int)352, height=(int)288, framerate=(fraction)20/1, format=(fourcc)YUY2</append> <append key="gstreamer.capabilities" type="strlist">video/x-raw-yuv, width=(int)352, height=(int)288, framerate=(fraction)15/1, format=(fourcc)YUY2</append> <append key="gstreamer.capabilities" type="strlist">video/x-raw-yuv, width=(int)352, height=(int)288, framerate=(fraction)10/1, format=(fourcc)YUY2</append> <append key="gstreamer.capabilities" type="strlist">video/x-raw-yuv, width=(int)352, height=(int)288, framerate=(fraction)5/1, format=(fourcc)YUY2</append> <append key="gstreamer.capabilities" type="strlist">video/x-raw-yuv, width=(int)1280, height=(int)960, framerate=(fraction)15/2, format=(fourcc)YUY2</append> <append key="gstreamer.capabilities" type="strlist">video/x-raw-yuv, width=(int)1280, height=(int)960, framerate=(fraction)5/1, format=(fourcc)YUY2</append> </match> </match> </device> </deviceinfo> Sorry I am a bit a slow.
OK, camera should work Some more questions: 1) Does gst-launch-0.10 v4l2src ! ffmpegcolorspace ! ximagesink work 2) Which version of gstreamer do you have installed. Run pkg-config --modversion gstreamer-0.10 3) Did you compile cheese yourself? 4) Can you run cheese --verbose and paste output
The first command does not work: [jdeslip@jdeslippe ~]$ gst-launch-0.10 v4l2src ! ffmpegcolorspace ! ximagesink Setting pipeline to PAUSED ... Pipeline is live and does not need PREROLL ... ERROR: from element /pipeline0/v4l2src0: Could not get enough buffers from device '/dev/video0'. Additional debug info: v4l2src_calls.c(1034): gst_v4l2src_capture_init (): /pipeline0/v4l2src0: we received 0 from device '/dev/video0', we want at least 2 ERROR: pipeline doesn't want to preroll. Setting pipeline to PAUSED ... Setting pipeline to READY ... Setting pipeline to NULL ... FREEING pipeline ... However, if I do like I said in my original post and add queue-size=2 it does: [jdeslip@jdeslippe ~]$ gst-launch-0.10 v4l2src queue-size=2 ! ffmpegcolorspace ! ximagesink Setting pipeline to PAUSED ... Pipeline is live and does not need PREROLL ... Setting pipeline to PLAYING ... New clock: GstSystemClock I am using 0.10.15: [jdeslip@jdeslippe ~]$ pkg-config --modversion gstreamer-0.10 0.10.15 Running cheese verbose gives the following output (ommiting lines about missing debug files): [jdeslip@jdeslippe ~]$ cheese --verbose device: /dev/video0 (and that is all now...)
Created attachment 102080 [details] [review] Patch with queue-size=2 Can you try cheese from SVN with this patch applied. It's actually a bug in gstreamer see bug #490034 That has been fixed but there has not been a release yet of gst-plugins-good
Running svn cheese with the patch applied renders me a serious backtrace that starts with: Detected webcam: Laptop Integrated Webcam device: /dev/v4l/video0 video/x-raw-yuv 352 x 288 num_framerates 4 30/1 15/1 10/1 5/1 video/x-raw-yuv 640 x 480 num_framerates 2 10/1 5/1 video/x-raw-yuv 320 x 240 num_framerates 4 30/1 15/1 10/1 5/1 video/x-raw-yuv 176 x 144 num_framerates 4 30/1 15/1 10/1 5/1 video/x-raw-yuv 160 x 120 num_framerates 4 30/1 15/1 10/1 5/1 v4l2src name=video_source device=/dev/v4l/video0 queue-size=2 ! video/x-raw-yuv,width=640,height=480,framerate=10/1 ! identity ** (cheese:7776): WARNING **: Size 4156 is not a multiple of unit size 614400 *** glibc detected *** cheese: munmap_chunk(): invalid pointer: 0x000000000066d630 ***
Not quite sure what I am doing, but a gdb where after the crash gives me this: (gdb) where
+ Trace 184052
Helpful?
The patch fixed cheese for me. I can now see myself - been a long time. If you look at my original bug report - it was more of a feature request that when I added queue-size=2 to the v4lsrc line in gconf that cheese should use that setting (i.e. why not just use what gconf is set to?) Thanks for all the effort. -Jack
Thanks fix has been committed 2008-01-05 Jaap Haitsma <jaap@haitsma.org> * src/cheese-webcam.c: Force queue-size=2 to make cheese work for some cameras which in gst-plugins-good 0.10.6 have a bug and queue-size is set to 0. This is fixed in gstreamer CVS already, but no release has been made yet. This patch fixes cheese bug #503503
thanks jaap! btw: i think a gconf option would be better than forcing it for all webcams. i dont know about that, but it _could_ produce other bugs for other cams
All cameras should have 2 buffers because that's the default for v4l2src and v4lsrc. So we should be fine. We can remove this as soon as we depend of 0.10.7 of gst-plugins-good
ok!
As this bug is marked as resolved, should I file a new bug with the "** (cheese:11304): WARNING **: Size 4156 is not a multiple of unit size 614400" error (see comment #21)?
the missing queue-size attribute bug has been fixed in gstreamer 0.10.7, scheduled to be released on February 18th. therefore we wont add it to the development version of cheese
*** Bug 513563 has been marked as a duplicate of this bug. ***
*** Bug 508912 has been marked as a duplicate of this bug. ***