After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 587174 - [v4l2src] First 2-3 seconds of recording are broken
[v4l2src] First 2-3 seconds of recording are broken
Status: RESOLVED INCOMPLETE
Product: GStreamer
Classification: Platform
Component: gst-plugins-good
git master
Other Linux
: Normal normal
: git master
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2009-06-28 08:01 UTC by Michael Monreal
Modified: 2011-08-16 09:39 UTC
See Also:
GNOME target: ---
GNOME version: 2.25/2.26


Attachments
Sample recording (949.70 KB, application/x-bzip)
2009-06-28 08:03 UTC, Michael Monreal
Details

Description Michael Monreal 2009-06-28 08:01:29 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.
Comment 1 Michael Monreal 2009-06-28 08:03:23 UTC
Created attachment 137485 [details]
Sample recording
Comment 2 Filippo Argiolas 2009-06-28 08:18:33 UTC
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?
Comment 3 Michael Monreal 2009-06-28 09:03:17 UTC
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?
Comment 4 Filippo Argiolas 2009-06-28 09:18:24 UTC
(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..

Comment 5 Michael Monreal 2009-06-28 09:52:51 UTC
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.
Comment 6 Filippo Argiolas 2009-09-14 17:33:33 UTC
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.
Comment 7 Michael Monreal 2009-09-14 18:16:36 UTC
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
Comment 8 Filippo Argiolas 2009-09-22 10:56:53 UTC
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)
Comment 9 Michael Monreal 2009-09-23 11:30:48 UTC
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)
Comment 10 Tobias Mueller 2010-04-09 16:30:47 UTC
Reopening as I can't see any open question
Comment 11 Cai Yuanqing 2010-12-30 06:32:56 UTC
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
Comment 12 Sebastian Dröge (slomo) 2011-05-20 07:03:53 UTC
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...
Comment 13 Akhil Laddha 2011-07-04 05:27:29 UTC
Michael, can you please provide information requested in comment#12 ?
Comment 14 Akhil Laddha 2011-08-16 09:39:16 UTC
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.