Problem with caps between v4l2src and autovideosink

Prabhakar Lad prabhakar.csengg at gmail.com
Thu Sep 18 09:24:30 PDT 2014


Hello,

On Thu, Sep 18, 2014 at 11:39 AM, Alicia Romero <alromor84 at gmail.com> wrote:
> Hi people!
> I have a camera installed in /dev/video0.
>
> The pipeline:
> gst-launch -v v4l2src ! autovideosink
>
> works perfectly and I can see which caps between v4l2src and autovideosink
> are used:
> /GstPipeline:pipeline0/GstAutoVideoSink:autovideosink0.GstGhostPad:sink:
> caps = video/x-raw-yuv, format=(fourcc)YUY2, width=(int)1600,
> height=(int)1200, interlaced=(boolean)false,
> pixel-aspect-ratio=(fraction)1/1, framerate=(fraction)5/1
>
> Now I want to write a small application doing the same:
>   [...]
>   source = gst_element_factory_make ("v4l2src", "source");
>   sink = gst_element_factory_make ("autovideosink", "sink");
>   caps_filter = gst_element_factory_make("capsfilter", "filter");
>   [...]
>  caps = gst_caps_new_simple("video/x-raw",
>               "framerate", GST_TYPE_FRACTION, 5, 1,
>               "format", G_TYPE_STRING, "YUY2",
>               "width", G_TYPE_INT, 1600,
>               "height", G_TYPE_INT, 1200,
>               NULL);
>  g_object_set(G_OBJECT(caps_filter), "caps", caps, NULL);
>   [...]
>
> But it is not working, I get:
> Error received from element source: Internal data flow error.
> Debugging information: gstbasesrc.c(2933): gst_base_src_loop ():
> /GstPipeline:test-pipeline/GstV4l2Src:source:
> streaming task paused, reason not-negotiated (-4)
>
That wont work if you are trying to add capsfilter, you need to
add videoconvert element after your capsfilter for example try below pipeline,

gst-launch-1.0 -v v4l2src ! video/x-raw, format=YUY2, width=1600,
height=1200,  framerate=5/1 ! videoconvert ! autovideosink

Implement the above pipeline in your program and should be working!

Thanks,
--Prabhakar

> I suppose the error is because of the caps incompatibility between v4l2src
> and caps_filter.
> Does anyone know why is not working and which caps can I use in my
> application?
>
> Thanks!!
>
> _______________________________________________
> gstreamer-devel mailing list
> gstreamer-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
>


More information about the gstreamer-devel mailing list