GNOME Bugzilla – Bug 642909
v4l2src and displaying YUY2 doesn't work
Last modified: 2011-11-18 10:53:01 UTC
I've been trying to get my app working using the v4l2src using my laptop and I couldn't get a clean implementation, so I'm guessing it's a v4l2src problem. I'll try to describe it here. The problem is that if I try to get some pictures I get this output: kde-devel@thinktatil:~/projects/kamoso$ gst-launch-0.10 -vv v4l2src ! ffmpegcolorspace ! autovideosink Setting pipeline to PAUSED ... /GstPipeline:pipeline0/GstV4l2Src:v4l2src0.GstPad:src: caps = video/x-raw-yuv, format=(fourcc)YUY2, width=(int)1600, height=(int)1200, interlaced=(boolean)false, framerate=(fraction)5/1 Pipeline is live and does not need PREROLL ... Setting pipeline to PLAYING ... New clock: GstSystemClock The problem is that it never starts to play. I guessed that it's because of being receiving this YUY2, so I tried that: gst-launch-0.10 -vv v4l2src ! video/x-raw-yuv, format="(fourcc)"I420, width=640 ! autovideosink Setting pipeline to PAUSED ... /GstPipeline:pipeline0/GstV4l2Src:v4l2src0.GstPad:src: caps = video/x-raw-yuv, format=(fourcc)I420, width=(int)640, height=(int)480, interlaced=(boolean)false, framerate=(fraction)30/1 Pipeline is live and does not need PREROLL ... Setting pipeline to PLAYING ... New clock: GstSystemClock /GstPipeline:pipeline0/GstCapsFilter:capsfilter0.GstPad:src: caps = video/x-raw-yuv, format=(fourcc)I420, width=(int)640, height=(int)480, interlaced=(boolean)false, framerate=(fraction)30/1 /GstPipeline:pipeline0/GstCapsFilter:capsfilter0.GstPad:sink: caps = video/x-raw-yuv, format=(fourcc)I420, width=(int)640, height=(int)480, interlaced=(boolean)false, framerate=(fraction)30/1 /GstPipeline:pipeline0/GstAutoVideoSink:autovideosink0/GstXvImageSink:autovideosink0-actual-sink-xvimage.GstPad:sink: caps = video/x-raw-yuv, format=(fourcc)I420, width=(int)640, height=(int)480, interlaced=(boolean)false, framerate=(fraction)30/1 /GstPipeline:pipeline0/GstAutoVideoSink:autovideosink0.GstGhostPad:sink: caps = video/x-raw-yuv, format=(fourcc)I420, width=(int)640, height=(int)480, interlaced=(boolean)false, framerate=(fraction)30/1 /GstPipeline:pipeline0/GstAutoVideoSink:autovideosink0.GstGhostPad:sink.GstProxyPad:proxypad0: caps = video/x-raw-yuv, format=(fourcc)I420, width=(int)640, height=(int)480, interlaced=(boolean)false, framerate=(fraction)30/1 ERROR: from element /GstPipeline:pipeline0/GstAutoVideoSink:autovideosink0/GstXvImageSink:autovideosink0-actual-sink-xvimage: Output window was closed Additional debug info: xvimagesink.c(1318): gst_xvimagesink_handle_xevents (): /GstPipeline:pipeline0/GstAutoVideoSink:autovideosink0/GstXvImageSink:autovideosink0-actual-sink-xvimage Execution ended after 3301415763 ns. Setting pipeline to PAUSED ... Setting pipeline to READY ... /GstPipeline:pipeline0/GstAutoVideoSink:autovideosink0/GstXvImageSink:autovideosink0-actual-sink-xvimage.GstPad:sink: caps = NULL /GstPipeline:pipeline0/GstAutoVideoSink:autovideosink0.GstGhostPad:sink: caps = NULL /GstPipeline:pipeline0/GstCapsFilter:capsfilter0.GstPad:src: caps = NULL /GstPipeline:pipeline0/GstCapsFilter:capsfilter0.GstPad:sink: caps = NULL /GstPipeline:pipeline0/GstV4l2Src:v4l2src0.GstPad:src: caps = NULL Setting pipeline to NULL ... Freeing pipeline ... But here the problem I see is that, on one hand, the resource consumption is quite high (i guess because of some internal colorspace conversion) and also because it just doesn't feel right to force a format for all users. I'll be happy to provide anything that can help solve that problem. Thanks
Could you check if gst-launch-0.10 -v v4l2src ! fakesink gives some output? There should be lines like /GstPipeline:pipeline0/GstFakeSink:fakesink0: last-message = "chain ******* < (153600 bytes, timestamp: 0:00:31.500000000, duration: 0:00:00.033333333, offset: 945, offset_end: 946, flags: 0) 0x1e7fe80" Please paste the first 30-40 lines (up to the first few chain messages like the one above)
apol@thinktatil:~$ gst-launch-0.10 -v v4l2src ! fakesink Setting pipeline to PAUSED ... /GstPipeline:pipeline0/GstV4l2Src:v4l2src0.GstPad:src: caps = video/x-raw-yuv, format=(fourcc)YUY2, width=(int)1600, height=(int)1200, interlaced=(boolean)false, framerate=(fraction)5/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)1600, height=(int)1200, interlaced=(boolean)false, framerate=(fraction)5/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;) 0x8b5d2c8" /GstPipeline:pipeline0/GstFakeSink:fakesink0: last-message = "chain ******* < (3840000 bytes, timestamp: 0:00:01.040114036, duration: 0:00:00.200000000, offset: 0, offset_end: 1, flags: 32) 0x8b4de88" /GstPipeline:pipeline0/GstFakeSink:fakesink0: last-message = "chain ******* < (3840000 bytes, timestamp: 0:00:01.240060721, duration: 0:00:00.200000000, offset: 1, offset_end: 2, flags: 0) 0x8b4ded8" /GstPipeline:pipeline0/GstFakeSink:fakesink0: last-message = "chain ******* < (3840000 bytes, timestamp: 0:00:01.440152623, duration: 0:00:00.200000000, offset: 2, offset_end: 3, flags: 0) 0x8b4df28" /GstPipeline:pipeline0/GstFakeSink:fakesink0: last-message = "chain ******* < (3840000 bytes, timestamp: 0:00:01.640187253, duration: 0:00:00.200000000, offset: 3, offset_end: 4, flags: 0) 0x8b4df78" /GstPipeline:pipeline0/GstFakeSink:fakesink0: last-message = "chain ******* < (3840000 bytes, timestamp: 0:00:01.840286388, duration: 0:00:00.200000000, offset: 4, offset_end: 5, flags: 0) 0x8b68000" /GstPipeline:pipeline0/GstFakeSink:fakesink0: last-message = "chain ******* < (3840000 bytes, timestamp: 0:00:02.040268859, duration: 0:00:00.200000000, offset: 5, offset_end: 6, flags: 0) 0x8b68050" /GstPipeline:pipeline0/GstFakeSink:fakesink0: last-message = "chain ******* < (3840000 bytes, timestamp: 0:00:02.240264415, duration: 0:00:00.200000000, offset: 6, offset_end: 7, flags: 0) 0x8b680a0" /GstPipeline:pipeline0/GstFakeSink:fakesink0: last-message = "chain ******* < (3840000 bytes, timestamp: 0:00:02.440315891, duration: 0:00:00.200000000, offset: 7, offset_end: 8, flags: 0) 0x8b680f0" /GstPipeline:pipeline0/GstFakeSink:fakesink0: last-message = "chain ******* < (3840000 bytes, timestamp: 0:00:02.641025687, duration: 0:00:00.200000000, offset: 8, offset_end: 9, flags: 0) 0x8b68140" /GstPipeline:pipeline0/GstFakeSink:fakesink0: last-message = "chain ******* < (3840000 bytes, timestamp: 0:00:02.840514815, duration: 0:00:00.200000000, offset: 9, offset_end: 10, flags: 0) 0x8b68190" /GstPipeline:pipeline0/GstFakeSink:fakesink0: last-message = "chain ******* < (3840000 bytes, timestamp: 0:00:03.040671925, duration: 0:00:00.200000000, offset: 10, offset_end: 11, flags: 0) 0x8b681e0" /GstPipeline:pipeline0/GstFakeSink:fakesink0: last-message = "chain ******* < (3840000 bytes, timestamp: 0:00:03.240840525, duration: 0:00:00.200000000, offset: 11, offset_end: 12, flags: 0) 0x8b68230" /GstPipeline:pipeline0/GstFakeSink:fakesink0: last-message = "chain ******* < (3840000 bytes, timestamp: 0:00:03.440723363, duration: 0:00:00.200000000, offset: 12, offset_end: 13, flags: 0) 0x8b68280" /GstPipeline:pipeline0/GstFakeSink:fakesink0: last-message = "chain ******* < (3840000 bytes, timestamp: 0:00:03.641215876, duration: 0:00:00.200000000, offset: 13, offset_end: 14, flags: 0) 0x8b682d0" /GstPipeline:pipeline0/GstFakeSink:fakesink0: last-message = "chain ******* < (3840000 bytes, timestamp: 0:00:03.840704486, duration: 0:00:00.200000000, offset: 14, offset_end: 15, flags: 0) 0x8b68320" /GstPipeline:pipeline0/GstFakeSink:fakesink0: last-message = "chain ******* < (3840000 bytes, timestamp: 0:00:04.040834239, duration: 0:00:00.200000000, offset: 15, offset_end: 16, flags: 0) 0x8b68370" /GstPipeline:pipeline0/GstFakeSink:fakesink0: last-message = "chain ******* < (3840000 bytes, timestamp: 0:00:04.240770854, duration: 0:00:00.200000000, offset: 16, offset_end: 17, flags: 0) 0x8b68408" /GstPipeline:pipeline0/GstFakeSink:fakesink0: last-message = "chain ******* < (3840000 bytes, timestamp: 0:00:04.440770882, duration: 0:00:00.200000000, offset: 17, offset_end: 18, flags: 0) 0x8b68458" /GstPipeline:pipeline0/GstFakeSink:fakesink0: last-message = "chain ******* < (3840000 bytes, timestamp: 0:00:04.641380623, duration: 0:00:00.200000000, offset: 18, offset_end: 19, flags: 0) 0x8b684a8" /GstPipeline:pipeline0/GstFakeSink:fakesink0: last-message = "chain ******* < (3840000 bytes, timestamp: 0:00:04.840892968, duration: 0:00:00.200000000, offset: 19, offset_end: 20, flags: 0) 0x8b684f8" /GstPipeline:pipeline0/GstFakeSink:fakesink0: last-message = "chain ******* < (3840000 bytes, timestamp: 0:00:05.040951223, duration: 0:00:00.200000000, offset: 20, offset_end: 21, flags: 0) 0x8b684a8" /GstPipeline:pipeline0/GstFakeSink:fakesink0: last-message = "chain ******* < (3840000 bytes, timestamp: 0:00:05.241112981, duration: 0:00:00.200000000, offset: 21, offset_end: 22, flags: 0) 0x8b68458" /GstPipeline:pipeline0/GstFakeSink:fakesink0: last-message = "chain ******* < (3840000 bytes, timestamp: 0:00:05.440997946, duration: 0:00:00.200000000, offset: 22, offset_end: 23, flags: 0) 0x8b68408" /GstPipeline:pipeline0/GstFakeSink:fakesink0: last-message = "chain ******* < (3840000 bytes, timestamp: 0:00:05.641658176, duration: 0:00:00.200000000, offset: 23, offset_end: 24, flags: 0) 0x8b68370" /GstPipeline:pipeline0/GstFakeSink:fakesink0: last-message = "chain ******* < (3840000 bytes, timestamp: 0:00:05.840971793, duration: 0:00:00.200000000, offset: 24, offset_end: 25, flags: 0) 0x8b68320" /GstPipeline:pipeline0/GstFakeSink:fakesink0: last-message = "chain ******* < (3840000 bytes, timestamp: 0:00:06.040959201, duration: 0:00:00.200000000, offset: 25, offset_end: 26, flags: 0) 0x8b682d0" /GstPipeline:pipeline0/GstFakeSink:fakesink0: last-message = "chain ******* < (3840000 bytes, timestamp: 0:00:06.241009049, duration: 0:00:00.200000000, offset: 26, offset_end: 27, flags: 0) 0x8b68280" /GstPipeline:pipeline0/GstFakeSink:fakesink0: last-message = "chain ******* < (3840000 bytes, timestamp: 0:00:06.440969877, duration: 0:00:00.200000000, offset: 27, offset_end: 28, flags: 0) 0x8b68230" /GstPipeline:pipeline0/GstFakeSink:fakesink0: last-message = "chain ******* < (3840000 bytes, timestamp: 0:00:06.641349628, duration: 0:00:00.200000000, offset: 28, offset_end: 29, flags: 0) 0x8b681e0" /GstPipeline:pipeline0/GstFakeSink:fakesink0: last-message = "chain ******* < (3840000 bytes, timestamp: 0:00:06.841021126, duration: 0:00:00.200000000, offset: 29, offset_end: 30, flags: 0) 0x8b68190" ^CCaught interrupt -- handling interrupt. Interrupt: Stopping pipeline ... Execution ended after 7237917356 ns. Setting pipeline to PAUSED ... Setting pipeline to READY ... /GstPipeline:pipeline0/GstFakeSink:fakesink0.GstPad:sink: caps = NULL /GstPipeline:pipeline0/GstV4l2Src:v4l2src0.GstPad:src: caps = NULL Setting pipeline to NULL ... Freeing pipeline ...
Thanks, so that's more a problem between autovideosink and ffmpegcolorspace I guess. Does it work with a specific sink, like ximagesink or xvimagesink (when putting ffmpegcolorspace before it of course)?
No, adding ffmpegcolorspace doesn't solve it. Both get stuck like that: apol@thinktatil:~/Downloads$ gst-launch-0.10 -vv v4l2src ! ffmpegcolorspace ! xvimagesink Setting pipeline to PAUSED ... /GstPipeline:pipeline0/GstV4l2Src:v4l2src0.GstPad:src: caps = video/x-raw-yuv, format=(fourcc)YUY2, width=(int)1600, height=(int)1200, interlaced=(boolean)false, framerate=(fraction)5/1 Pipeline is live and does not need PREROLL ... Setting pipeline to PLAYING ... New clock: GstSystemClock ^CCaught interrupt -- handling interrupt. Interrupt: Stopping pipeline ... Execution ended after 5990034239 ns. Setting pipeline to PAUSED ... Setting pipeline to READY ... /GstPipeline:pipeline0/GstV4l2Src:v4l2src0.GstPad:src: caps = NULL Setting pipeline to NULL ... Freeing pipeline ... even if I force a smaller resolution.
Can you make a debug log and attach it here? GST_DEBUG_NO_COLOR=1 GST_DEBUG="*:2,v4l2*:5,ffmpeg*:5,xvimage*:5" gst-launch-0.10 2>debug.log v4l2src ! ffmpegcolorspace ! xvimagesink Ctrl-C when its stuck. bzip2 debug.log and attach it here
Created attachment 182180 [details] Debug Log
Here it is :)
I suspect a driver issue - the last log message before you ctrl-c is: 0:00:00.152696416 28996 0x9a76000 DEBUG v4l2src v4l2src_calls.c:110:gst_v4l2src_grab_frame:<v4l2src0> grab frame and that leads to v4l2_ioctl (pool->video_fd, VIDIOC_DQBUF, &buffer) in gstv4l2bufferpools.c:gst_v4l2_buffer_pool_dqbuf() have you tried other v4l2-camera software with that camera?
Can you please try with latest -good ? This sounds a bit like 3968dc7688021cdf1d1c52e6d7838668bdccb2e1 which would cause a wedge grabbing a frame.
Aleix, ping, were you able to retest the problem as requested in comment#9 ?
I can't reproduce anymore. This bug is solved for me.