[gst-devel] Uncooperative v4lsrc devices

Greg Logan greg.logan at usask.ca
Tue Jun 30 01:15:46 CEST 2009


Hi List,

I'm working with an Epiphan VGA2USB capture device which uses the older
Video4Linux API.  I'm trying to capture a 1024x768 desktop display to a plain
MPEG file, but I can't for the life of me get it to capture properly.  The
encoding machine is a Core2Quad Q6600 running Ubuntu 9.04 x86_64.

I'm currently using the commandline interface for gStreamer while I experiment,
and the command I've found that works best is

sudo gst-launch -v v4lsrc num-buffers=100 ! videorate !
video/x-raw-yuv,width=1024,height=768 ! videoparse height=768 width=1024
format=YUY2 ! ffmpegcolorspace ! mpeg2enc framerate=0 ! filesink
location=./test.mpg

The problem is that the video, when played back, plays at a very high speed. 
Almost as if it's being played in fast forward.  I've tried setting the
framerate manually, but then I get:

greg at machine:~/Desktop$ sudo gst-launch -v v4lsrc num-buffers=100 ! videorate !
video/x-raw-yuv,width=1024,height=768,framerate=20/1 ! videoparse height=768
width=1024 format=YUY2 framerate=20/1 ! ffmpegcolorspace ! mpeg2enc framerate=0
interlace-mode=0 ! filesink location=./test.mpg
Setting pipeline to PAUSED ...
/GstPipeline:pipeline0/GstV4lSrc:v4lsrc0.GstPad:src: caps = video/x-raw-yuv,
format=(fourcc)YUY2, width=(int)1024, height=(int)768, framerate=(fraction)25/1
Pipeline is live and does not need PREROLL ...
Setting pipeline to PLAYING ...
New clock: GstSystemClock
/GstPipeline:pipeline0/GstVideoRate:videorate0.GstPad:sink: caps =
video/x-raw-yuv, format=(fourcc)YUY2, width=(int)1024, height=(int)768,
framerate=(fraction)25/1
/GstPipeline:pipeline0/GstVideoRate:videorate0.GstPad:src: caps =
video/x-raw-yuv, width=(int)1024, height=(int)768, framerate=(fraction)20/1,
format=(fourcc)YUY2
/GstPipeline:pipeline0/GstVideoRate:videorate0.GstPad:sink: caps =
video/x-raw-yuv, format=(fourcc)YUY2, width=(int)1024, height=(int)768,
framerate=(fraction)25/1
/GstPipeline:pipeline0/GstCapsFilter:capsfilter0.GstPad:src: caps =
video/x-raw-yuv, width=(int)1024, height=(int)768, framerate=(fraction)20/1,
format=(fourcc)YUY2
/GstPipeline:pipeline0/GstCapsFilter:capsfilter0.GstPad:sink: caps =
video/x-raw-yuv, width=(int)1024, height=(int)768, framerate=(fraction)20/1,
format=(fourcc)YUY2
/GstPipeline:pipeline0/GstVideoParse:videoparse0.GstPad:sink: caps =
video/x-raw-yuv, width=(int)1024, height=(int)768, framerate=(fraction)20/1,
format=(fourcc)YUY2
/GstPipeline:pipeline0/GstVideoParse:videoparse0.GstPad:src: caps =
video/x-raw-yuv, width=(int)1024, height=(int)768, format=(fourcc)YUY2,
framerate=(fraction)20/1, pixel-aspect-ratio=(fraction)1/1
ERROR: from element /GstPipeline:pipeline0/GstV4lSrc:v4lsrc0: Internal data flow
error.
Additional debug info:
gstbasesrc.c(2330): gst_base_src_loop ():
/GstPipeline:pipeline0/GstV4lSrc:v4lsrc0:
streaming task paused, reason not-negotiated (-4)
Execution ended after 204010194 ns.
Setting pipeline to PAUSED ...
Setting pipeline to READY ...
/GstPipeline:pipeline0/GstVideoParse:videoparse0.GstPad:src: caps = NULL
/GstPipeline:pipeline0/GstVideoParse:videoparse0.GstPad:sink: caps = NULL
/GstPipeline:pipeline0/GstCapsFilter:capsfilter0.GstPad:src: caps = NULL
/GstPipeline:pipeline0/GstCapsFilter:capsfilter0.GstPad:sink: caps = NULL
/GstPipeline:pipeline0/GstVideoRate:videorate0.GstPad:src: caps = NULL
/GstPipeline:pipeline0/GstVideoRate:videorate0.GstPad:sink: caps = NULL
/GstPipeline:pipeline0/GstV4lSrc:v4lsrc0.GstPad:src: caps = NULL
Setting pipeline to NULL ...
FREEING pipeline ...

The *only* framerate that I seems to work is the 25/1 listed in the cap
description for the v4lsrc element, and the output for at is identical to the
output when I don't specify the framerate at all.  I am relatively certain that
the device is capable out lower framerates because Epiphan includes some
examples using transcode (transcode -x v4l,null --use_rgb -i /dev/video -f 3 -g
1600x1200 -y raw,null -z -r 2 -f 10 -o test.avi), but I can't seem to get lower
framerates working in gStreamer.

So, my questions are:  Am I doing something wrong here with regards to
gStreamer?  And how can I get the output video to play back at a proper rate?

I'm relatively new to the framework but it doesn't seem too difficult to learn.

Thanks,
G

PS:  Just so this is out on the internet somewhere:  To get v4lsrc to work with
Epiphan's drivers you need to add "num_frame_buffers=2" to the insmod when
inserting the drivers.  Otherwise you get:
ERROR: from element /GstPipeline:pipeline0/GstV4lSrc:v4lsrc0: Could not read
from resource.
Additional debug info:
v4lsrc_calls.c(183): gst_v4lsrc_capture_init ():
/GstPipeline:pipeline0/GstV4lSrc:v4lsrc0:
Not enough buffers. We got 1, we want at least 2




More information about the gstreamer-devel mailing list