GNOME Bugzilla – Bug 676093
v4l2src: 10 fps with gstreamer-properties, but 30 fps with guvcview
Last modified: 2013-04-21 15:49:53 UTC
Overview: With guvcview I get 30fps on 1280x720 resolution, but via gstreamer-properties I only get 10 fps. I am using Microsoft Lifecam Cinema webcam on 1280x720. Plugin I'm using is V4L2. OS: Ubuntu 10.10 I'm not sure if this is a bug or a misconfiguration on my side.
Installing gstreamer-tools and doing this: gst-launch v4l2src device=/dev/video0 ! 'video/x-raw-yuv,width=1280,height=720,framerate=30/1' ! xvimagesink Is working and gives me a webcam feed with 30fps. Starting via gstreamer-properties still only gives me 10 fps.
What does gst-launch-0.10 -v v4l2src device=/dev/video0 ! fakesink show? You might also want to check the debug log: GST_DEBUG=v4l2*:5 gst-launch-0.10 -v v4l2src device=/dev/video0 ! fakesink 2>&1 | less -R perhaps it negotiates to a different/higher resolution where only a lower framerate is available? (gstreamer-properties is part of gnome-media and deprecated/outdated, I think, fwiw)
Oh also: what's the output of: gst-inspect-0.10 v4l2src | grep Version ? The latest gst-plugins-good release is 0.10.31 - it looks like you might be using an old version. Perhaps you could test with the latest releases.
Thank you for your quick reply Tim-Philipp. gst-launch-0.10 -v v4l2src device=/dev/video0 ! fakesink Shows: Setting pipeline to PAUSED ... /GstPipeline:pipeline0/GstV4l2Src:v4l2src0.GstPad:src: caps = video/x-raw-yuv, format=(fourcc)YUY2, width=(int)1280, height=(int)800, interlaced=(boolean)false, framerate=(fraction)10/1 Pipeline is live and does not need PREROLL ... Setting pipeline to PLAYING ... New clock: GstSystemClock /GstPipeline:pipeline0/GstFakeSink:fakesink0.GstPad:sink: caps = video/x-raw-yuv, format=(fourcc)YUY2, width=(int)1280, height=(int)800, interlaced=(boolean)false, framerate=(fraction)10/1 /GstPipeline:pipeline0/GstFakeSink:fakesink0: last-message = "preroll ******* " /GstPipeline:pipeline0/GstFakeSink:fakesink0: last-message = "event ******* E (type: 102, GstEventNewsegment, update=(boolean)false, rate=(double)1, applied-rate=(double)1, format=(GstFormat)GST_FORMAT_TIME, start=(gint64)0, stop=(gint64)-1, position=(gint64)0;) 0x989a078" /GstPipeline:pipeline0/GstFakeSink:fakesink0: last-message = "chain ******* < (2048000 bytes, timestamp: 0:00:00.078792782, duration: 0:00:00.100000000, offset: 0, offset_end: 1, flags: 32 discont ) 0x988a298" /GstPipeline:pipeline0/GstFakeSink:fakesink0: last-message = "chain ******* < (2048000 bytes, timestamp: 0:00:00.178537936, duration: 0:00:00.100000000, offset: 1, offset_end: 2, flags: 0 ) 0x988a2e8" /GstPipeline:pipeline0/GstFakeSink:fakesink0: last-message = "chain ******* < (2048000 bytes, timestamp: 0:00:00.278799935, duration: 0:00:00.100000000, offset: 2, offset_end: 3, flags: 0 ) 0x988a338" /GstPipeline:pipeline0/GstFakeSink:fakesink0: last-message = "chain ******* < (2048000 bytes, timestamp: 0:00:00.378555552, duration: 0:00:00.100000000, offset: 3, offset_end: 4, flags: 0 ) 0x988a388" This continues endless (I think, I waited untill offset 140) The output of gst-inspect-0.10 v4l2src | grep Version is: Version: 0.10.29 I indeed seems like I'm on an old version...
I'm now on verion 0.10.31, but I had to install from source (Synaptics only showed 0.10.29) Probably this does not belong on bugzilla, sorry, but now guvcview and gst-launch v4l2src are not working anymore. Giving me: WARNING: erroneous pipeline: no element "xvimagesink" I removed the updated version and returned to the version in Synaptics. Now I'm gettings this error with gst-launch: (gst-plugin-scanner:2113): GStreamer-WARNING **: Failed to load plugin '/usr/lib/gstreamer-0.10/libgstvideoscale.so': /usr/local/lib/libgstvideo-0.10.so.0: undefined symbol: gst_buffer_get_qdata Also guvcview and even Ubuntu software center don't want to start anymore. I did something wrong...
Hrm, yes, sorry, you shouldn't really mix a from-source install with packages. There's a GStreamer PPA for ubuntu with newer versions. If you still have the source tree(s), I would recommend a 'sudo make uninstall' in them.
Thank you Tim-Philipp, that fixed my Ubuntu Software Center. I first tried with the GStreamer PPA, but there is no update available. Now I reverted v4l2src to 0.10.29 again, I added the PPA again, but Synaptics does not think there are any updates for gstreamer
Ok, then could you make a log like this please from gnome-terminal or so: $ GST_DEBUG=v4l2*:5 gst-launch-0.10 v4l2src device=/dev/video0 num-buffers=1 ! fakesink 2>dbg.log and then attach dbg.log to this bug report? (gzip it if it's larger than 1MB). Bug #665387 could be related.
Created attachment 214169 [details] dbg.log
This camera supports two modes: - raw YUYV capture with a max framerate of 10/1 at 1280x700 - MJPG with a max framerate of 30/1 at 1280x700 There are also some emulated modes and other dimenstions and framerates. The emulated modes seem to do a jpeg decompression because they also support higher framerates. What gstreamer does is negotiate to the first raw YUYV format at 1280x700. You can force it do another format like in Comment 4 (which likely enables the emulation mode). What can be done is to make it negotiate to something else.. I think 640x480@30 fps would be a more reasonable default.
> What can be done is to make it negotiate to something else.. I think 640x480@30 > fps would be a more reasonable default. Perhaps. How would you find the best resolution * fps trade-off in this case ? But then what do we do if someone files a bug about getting 1280x720 resolution with guvcview and only 640x480 with GStreamer? Ultimately it's the application that needs to offer the different options to the user or select something best suited to its use case.
My personal goal is to get 30fps in my OpenCV c++ program. I think I traced it back to gstreamer, because [see first post]. Is there maybe a way to force gstreamer to always use MJPG or YUV 30fps with this resolution? I'm bound to the 1280x720 resolution, but not necessarily to YUV or MJPG. Thanks again
(In reply to comment #13) > My personal goal is to get 30fps in my OpenCV c++ program. I think I traced it > back to gstreamer, because [see first post]. Is there maybe a way to force > gstreamer to always use MJPG or YUV 30fps with this resolution? I'm bound to > the 1280x720 resolution, but not necessarily to YUV or MJPG. > Yes, add a capsfilter like in Comment 1.
Sorry for my ignorance, but how exactly can I do that to work with/in my OpenCV program? Or can I adjust gstreamer in such a way that it always has the capsfilter? (if so, how?)
How do you use GStreamer exactly? Usually a GStreamer-using library or application will create a GStreamer pipeline of some sort. In there there will be a v4l2src element, followed by other elements that use the data v4l2src produces in some way. When that pipeline is constructed, a capsfilter element can be inserted after v4l2src to select or filter the formats/resolutions/fps it should use. So it seems to me like this is basically NOTABUG, but something that needs to be done application-side or in the component that uses GStreamer.
Agreed that the application should offer a means to pick the capture mode.