Prevent GStreamer from changing camera format
Nikola Pantelic
pantelicn63 at gmail.com
Sun Oct 18 18:58:33 UTC 2020
(This question is also available at
https://stackoverflow.com/questions/64415461.)
Running GStreamer pipeline that feeds from v4l2src element may change
camera format implicitly.
Here is an example (also note that /dev/video0 is everywhere implied).
One of my cameras supports these formats
$ v4l2-ctl --list-formats-ext
ioctl: VIDIOC_ENUM_FMT
Type: Video Capture
[0]: 'YUYV' (YUYV 4:2:2)
Size: Discrete 640x480
Interval: Discrete 0.033s (30.000 fps)
Interval: Discrete 0.067s (15.000 fps)
Size: Discrete 320x240
Interval: Discrete 0.033s (30.000 fps)
Interval: Discrete 0.067s (15.000 fps)
Size: Discrete 1280x800
Interval: Discrete 0.133s (7.500 fps)
Size: Discrete 1280x1024
Interval: Discrete 0.133s (7.500 fps)
The current format is
$ v4l2-ctl --get-fmt-video
Format Video Capture:
Width/Height : 640/480
Pixel Format : 'YUYV' (YUYV 4:2:2)
Field : None
Bytes per Line : 1280
Size Image : 614400
Colorspace : Default
Transfer Function : Default (maps to Rec. 709)
YCbCr/HSV Encoding: Default (maps to ITU-R 601)
Quantization : Default (maps to Limited Range)
Flags :
If I just run this pipeline
$ gst-launch-1.0 -e v4l2src ! videoconvert ! autovideosink
This will change the current format (before the pipeline is run, but
it will also be left in that state) to
$ v4l2-ctl --get-fmt-video
Format Video Capture:
Width/Height : 1280/1024
Pixel Format : 'YUYV' (YUYV 4:2:2)
Field : None
Bytes per Line : 2560
Size Image : 2621440
Colorspace : Default
Transfer Function : Default (maps to Rec. 709)
YCbCr/HSV Encoding: Default (maps to ITU-R 601)
Quantization : Default (maps to Limited Range)
Flags :
And this is not what I want. What I want is for GStreamer to use
already set format and not change it. How I can accomplish that
programmatically (gst-launch-1.0 was just an example, I'm primarily
interested in doing this in code)?
More information about the gstreamer-devel
mailing list