[gst-devel] Problem Trying To Use v4l2src

Tim-Philipp Müller t.i.m at zen.co.uk
Wed Aug 19 01:13:45 CEST 2009


On Tue, 2009-08-18 at 17:30 -0500, Kulecz, Walter wrote:

> I'm evaluating the possibility of using gstreamer for the next version
> of my real time image processing application.  It seems I need to
> write a gstreamer plugin to get access to the actual data being passed
> through the gstreamer pipeline.

Not necessarily, but if you want to manipulate the data in the middle of
a pipeline writing an element is usually the right thing to do.

You can get data out of a pipeline using the appsink element, or the
fakesink element with a "handoff" signal handler, or the identity
element with a "handoff" signal handler, or by setting up a pad probe.


> I've succeed in using the gst-template to compile a simple filter
> plugin, but before I put much more effort into learning gstreamer I
> need to solve a problem with the v4l2src plugin.
> 
> My question is how do I initialize the plugin?  I need to set NTSC mode
> (some of our cards default to PAL on powerup), image size to 640x480
> (although it seems I could use one of the resize or cropping
> plugins),  select the composite or S-Video input (most cards seem to
> default to tuner), and maybe set 8-bit grayscale video mode (our
> cameras are monochrome).  

The desired pixel format/layout and resolution can be set by putting a
capsfilter with suitable filter caps after the v4l2src element. This
usually assumes the camera/drivers/libv4l support the exact format and
resolution desired. If you just want to get data in a particular
format/size no matter what you can put some converters like
ffmpegcolorspace and videoscale between v4l2src and your capsfilter, and
those elements will try their best to convert the data from the camera
into the desired format if the format isn't supported.

NTSC/PAL selection is done using the GstTuner interface (see
gst-plugins-base libraries docs), I believe. The device might need to be
open already when you use the interface (ie. the v4l2src element needs
to be set to at least READY or PAUSED state [it should be READY, but
IIRC the v4l elemens didn't implement that correctly until recently, so
you might need PAUSED instead depending on the version used]).

> If I run an application like TVtime first, the card then works with
> v4l2src in a simple gst-launch pipeline to test my plugin.  But it
> seems pretty fragile with respect to video errors often requiring
> another run of TVtime to reset the card so v4l2src will work.

What errors do you get? What does TVtime do to reset it?

Cheers
 -Tim





More information about the gstreamer-devel mailing list