<div dir="auto"><div><br><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">Le dim. 18 oct. 2020 17 h 00, Nikola Pantelic <<a href="mailto:pantelicn63@gmail.com">pantelicn63@gmail.com</a>> a écrit :<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">(This question is also available at<br>
<a href="https://stackoverflow.com/questions/64415461" rel="noreferrer noreferrer" target="_blank">https://stackoverflow.com/questions/64415461</a>.)<br>
<br>
<br>
Running GStreamer pipeline that feeds from v4l2src element may change<br>
camera format implicitly.<br>
<br>
Here is an example (also note that /dev/video0 is everywhere implied).<br>
<br>
One of my cameras supports these formats<br>
<br>
$ v4l2-ctl --list-formats-ext<br>
ioctl: VIDIOC_ENUM_FMT<br>
    Type: Video Capture<br>
<br>
    [0]: 'YUYV' (YUYV 4:2:2)<br>
        Size: Discrete 640x480<br>
            Interval: Discrete 0.033s (30.000 fps)<br>
            Interval: Discrete 0.067s (15.000 fps)<br>
        Size: Discrete 320x240<br>
            Interval: Discrete 0.033s (30.000 fps)<br>
            Interval: Discrete 0.067s (15.000 fps)<br>
        Size: Discrete 1280x800<br>
            Interval: Discrete 0.133s (7.500 fps)<br>
        Size: Discrete 1280x1024<br>
            Interval: Discrete 0.133s (7.500 fps)<br>
<br>
The current format is<br>
<br>
$ v4l2-ctl --get-fmt-video<br>
Format Video Capture:<br>
    Width/Height      : 640/480<br>
    Pixel Format      : 'YUYV' (YUYV 4:2:2)<br>
    Field             : None<br>
    Bytes per Line    : 1280<br>
    Size Image        : 614400<br>
    Colorspace        : Default<br>
    Transfer Function : Default (maps to Rec. 709)<br>
    YCbCr/HSV Encoding: Default (maps to ITU-R 601)<br>
    Quantization      : Default (maps to Limited Range)<br>
    Flags             :<br>
<br>
If I just run this pipeline<br>
<br>
$ gst-launch-1.0 -e v4l2src ! videoconvert ! autovideosink<br>
<br>
This will change the current format (before the pipeline is run, but<br>
it will also be left in that state) to<br>
<br>
$ v4l2-ctl --get-fmt-video<br>
Format Video Capture:<br>
    Width/Height      : 1280/1024<br>
    Pixel Format      : 'YUYV' (YUYV 4:2:2)<br>
    Field             : None<br>
    Bytes per Line    : 2560<br>
    Size Image        : 2621440<br>
    Colorspace        : Default<br>
    Transfer Function : Default (maps to Rec. 709)<br>
    YCbCr/HSV Encoding: Default (maps to ITU-R 601)<br>
    Quantization      : Default (maps to Limited Range)<br>
    Flags             :<br>
<br>
And this is not what I want. What I want is for GStreamer to use<br>
already set format and not change it. How I can accomplish that<br>
programmatically (gst-launch-1.0 was just an example, I'm primarily<br>
interested in doing this in code)?<br></blockquote></div></div><div dir="auto"><br></div><div dir="auto">When it reach ready state, you can get through properties the device fd, you can then configure a caps filter to preserve the last format used.</div><div dir="auto"><br></div><div dir="auto"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
_______________________________________________<br>
gstreamer-devel mailing list<br>
<a href="mailto:gstreamer-devel@lists.freedesktop.org" target="_blank" rel="noreferrer">gstreamer-devel@lists.freedesktop.org</a><br>
<a href="https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel" rel="noreferrer noreferrer" target="_blank">https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel</a><br>
</blockquote></div></div></div>