Unable to set Capabilities on v4l2src using C

iotsystek iotsystek at gmail.com
Thu Mar 18 20:44:37 UTC 2021

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= 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.

Sent from: http://gstreamer-devel.966125.n4.nabble.com/

More information about the gstreamer-devel mailing list