GNOME Bugzilla – Bug 587174
[v4l2src] First 2-3 seconds of recording are broken
Last modified: 2011-08-16 09:39:16 UTC
With recent versions of cheese (or gstreamer? or the kernel?) my webcam recordings are broken at the beginning. The image is not placed correctly for about 2-3 seconds, after that it works fine. The same webcam (some UVC capable device from Hercules) used to work perfectly.
Created attachment 137485 [details] Sample recording
Do you get any error from cheese -v? First frames are somewhat always broken.. it's the webcam starting up I suppose, I never saw anything like this but mine are broken too (too dark, sluggish). I suspect that your webcam starts streaming in the middle of a frame so you have to wait for a full one before to have a non broken one. Not sure why what triggered it recently, since when it is broken? maybe it worked before the advent of libv4l?
This is all I get on the console, there's no new message after recording starts until I end it: $ cheese -v Cheese 2.27.4 Probing devices with HAL... Found device 06f8:3005, getting capabilities... Detected v4l2 device: Hercules Dualpix Exchange Driver: uvcvideo, version: 256 Capabilities: 0x04000001 Probing supported video formats... Device: Hercules Dualpix Exchange (/dev/video0) video/x-raw-yuv 640 x 480 num_framerates 6 30/1 25/1 20/1 15/1 10/1 5/1 video/x-raw-yuv 352 x 288 num_framerates 6 30/1 25/1 20/1 15/1 10/1 5/1 video/x-raw-yuv 320 x 240 num_framerates 6 30/1 25/1 20/1 15/1 10/1 5/1 video/x-raw-yuv 176 x 144 num_framerates 6 30/1 25/1 20/1 15/1 10/1 5/1 video/x-raw-yuv 160 x 120 num_framerates 6 30/1 25/1 20/1 15/1 10/1 5/1 v4l2src name=video_source device=/dev/video0 ! capsfilter name=capsfilter caps=video/x-raw-rgb,width=640,height=480,framerate=30/1;video/x-raw-yuv,width=640,height=480,framerate=30/1 ! identity Sending EOS event down the recording pipeline Received EOS message I just compiled the last 2.26 release, same issue here... I don't know about libv4l. Any idea how to narrow this down?
(In reply to comment #3) > Any idea how to narrow this down? Nope, do you see the broken frame in the preview too or just in the recorded video? I really doubt cheese is involved..
After clicking the record button the preview area turns black for 2-3 seconds, then it works as expected. Those seem to be the same 2-3 seconds messed up in the output. Note that the "screenshot" shown in the output during the first seconds is not the first frame, it is somewhere in between second 0 and 2-3.
Does it happen with gst-launch too? gst-launch-0.10 v4l2src ! video/x-raw-yuv,width=640,height=480,framerate=30/1 ! theoraenc ! oggmux ! filesink location=test.ogv Let it run for a couple of seconds than press ctrl+c. Try also with x-raw-rgb. Reassigning this bug to gstreamer since as far as I know it happens with every camera out there and we had always had this issue with recording in cheese.
Those pipes don't seem to work: mimox@enigma:~/Desktop$ gst-launch-0.10 v4l2src ! video/x-raw-yuv,width=640,height=480,framerate=30/1 ! theoraenc ! oggmux ! filesink location=test.ogv Setting pipeline to PAUSED ... ERROR: Pipeline doesn't want to pause. ERROR: from element /GstPipeline:pipeline0/GstV4l2Src:v4l2src0: Could not negotiate format Additional debug info: gstbasesrc.c(2584): gst_base_src_start (): /GstPipeline:pipeline0/GstV4l2Src:v4l2src0: Check your filtered caps, if any Setting pipeline to NULL ... Freeing pipeline ... mimox@enigma:~/Desktop$ gst-launch-0.10 v4l2src ! video/x-raw-rgb,width=640,height=480,framerate=30/1 ! theoraenc ! oggmux ! filesink location=test.ogv WARNING: erroneous pipeline: could not link v4l2src0 to theoraenc0
Hi Michael, sorry for the delay. Try to put a ffmpegcolorspace between v4l2src caps and theoraenc: gst-launch-0.10 v4l2src ! video/x-raw-rgb, width=640,height=480,framerate=30/1 ! ffmpegcolorspace ! theoraenc ! oggmux ! filesink location=test.ogv (should work with both rgb and yuv if you have gst-plugins-good compiled with libv4l support)
gst-launch-0.10 v4l2src ! video/x-raw-rgb, width=640,height=480,framerate=30/1 ! ffmpegcolorspace ! theoraenc ! oggmux ! filesink location=test.ogv Setting pipeline to PAUSED ... ERROR: Pipeline doesn't want to pause. ERROR: from element /GstPipeline:pipeline0/GstV4l2Src:v4l2src0: Could not negotiate format Additional debug info: gstbasesrc.c(2584): gst_base_src_start (): /GstPipeline:pipeline0/GstV4l2Src:v4l2src0: Check your filtered caps, if any Setting pipeline to NULL ... Freeing pipeline ... But it seems to work with -yuv. I started the command and then slowly counted from 0 to 5 with my fingers. The output video starts with "2", so there seems to be a delay of about 2 seconds between start of the pipeline and actual recording. However the video looks good, the beginning is just cut off (no jumping etc)
Reopening as I can't see any open question
I think your pipeline is fine with my test result below: $ gst-launch-0.10 v4l2src ! 'video/x-raw-yuv,width=640,height=480,framerate=30/1' ! theoraenc ! oggmux ! filesink location=test.ogv Setting pipeline to PAUSED ... 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 10479945890 ns. Setting pipeline to PAUSED ... Setting pipeline to READY ... Setting pipeline to NULL ... Freeing pipeline ... caiiiyua@caiiiyua:~/workflow/gstreamer-dev$ gst-launch-0.10 filesrc location=test.ogv ! oggdemux ! theoradec ! 'video/x-raw-yuv,width=640,height=480,framerate=30/1' ! ffmpegcolorspace ! xvimagesink Setting pipeline to PAUSED ... Pipeline is PREROLLING ... Pipeline is PREROLLED ... Setting pipeline to PLAYING ... New clock: GstSystemClock ^CCaught interrupt -- handling interrupt. Interrupt: Stopping pipeline ... Execution ended after 6488258932 ns. Setting pipeline to PAUSED ... Setting pipeline to READY ... Setting pipeline to NULL ... Freeing pipeline ... BTW,I guess there is some compatible issue with your "CAMERA",maybe your camera isn't support any of the arguments in 'video/x-raw-yuv,width=640,height=480,framerate=30/1',you can check this out. And you can also try : $ gst-launch-0.10 videotestsrc ! 'video/x-raw-yuv,width=640,height=480,framerate=30/1' ! theoraenc ! oggmux ! filesink location=test.ogv In my opinion,your pipeline is good indeed. Hope it helps :-D
Please try with gst-launch-0.10 v4l2src ! ffmpegcolorspace ! theoraenc ! oggmux ! filesink location=test.ogv Does this create a file with broken first seconds too? I think this is a bug in your v4l2 driver though...
Michael, can you please provide information requested in comment#12 ?
Please feel free to reopen this bug if the problem still occurs with a newer version of GStreamer Core 0.10.35, Base Plugins 0.10.35, Good Plugins 0.10.30 stable release, tia.