Unable to set Capabilities on v4l2src using C

iotsystek iotsystek at gmail.com
Thu Mar 18 19:05:59 UTC 2021

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

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’

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/

More information about the gstreamer-devel mailing list