Unable to set Capabilities on v4l2src using C

Nicolas Dufresne nicolas at ndufresne.ca
Fri Mar 19 12:21:40 UTC 2021


Le jeu. 18 mars 2021 17 h 45, iotsystek <iotsystek at gmail.com> a écrit :

> iotsystek wrote
> > Setup:
> > I am using GStreamer 1.18.2 on embedded Linux with a couple of USB
> cameras
> > and sending the video to Windows.
> >
> > I have a working pipeline.
> > USB Cameras attached to the embedded computer using the following command
> > example:
> >
> > gst-launch-1.0 v4l2src device=/dev/video0 ! \
> >     'video/x-raw, width=640, height=480' ! \
> >     videorate max-rate=6 ! \
> >     videoconvert ! \
> >     x264enc pass=qual quantizer=20 tune=zerolatency ! \
> >     rtph264pay ! \
> >     udpsink host=192.168.168.32 port=1234
> >
> > The PC receives and displays the streams with no issue.
> >
> > Now I am attempting to translate the gst-launch-1.0 command into C code.
> > I
> > have been totally unsuccessful in setting the capabilities ('video/x-raw,
> > width=640, height=480') on the v4l2src, which does not have a ‘caps’
> > property.
> >
> > I would be grateful for both a code snippet / example detailing the C
> > source
> > code needed to do this and guidance as to where I might look to find this
> > kind of answer directly.  Is there a repository of GStreamer version 1.0
> C
> > Code snipets?
> >
> > Also related to the above.  Once I have this working I will need to be
> > able
> > to change these camera height and width capabilities.
> >
> > I also have a socket connection (totally unrelated to GStreamer) to the
> > embedded Linux system and use it for control and feedback of additional
> > hardware.  I will need to raise and lower the cameras width and height
> > while
> > it is running via this socket connection.  Will I have to totally stop
> the
> > video flow or is there a way to adjust these setting on the fly.
> >
> > Again the code snippet would be greatly appreciated.
> >
> >
> >
> >
> > --
> > Sent from: http://gstreamer-devel.966125.n4.nabble.com/
> > _______________________________________________
> > gstreamer-devel mailing list
>
> > gstreamer-devel at .freedesktop
>
> > https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
>
> Got it working…
>
> It turns out that:
>     'video/x-raw, width=640, height=480' ! \
> Translates to:
>     capsfilter caps='video/x-raw, width=800, height=600' ! \
>
> capsfilter has a caps property which is easily set and capsfilter is
> applied
> to the preceding element in the chain.
>
> So at this point.
> Any help or suggested best practices on changing parameters (width, height)
> on the fly would be greatly appreciated.
>

I think you want to use the device provider to get the list of caps.
Whatever you want to set on caps filter, you should check that it intersect
with the capabilities from the provider.

Then it's just a matter of setting the caps. It can be changed at runtime,
note that the change is asynchronous, expect few frames delay.


>
>
>
> --
> Sent from: http://gstreamer-devel.966125.n4.nabble.com/
> _______________________________________________
> gstreamer-devel mailing list
> gstreamer-devel at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/gstreamer-devel/attachments/20210319/7fbaf418/attachment.htm>


More information about the gstreamer-devel mailing list