Is gstreamer disable the setting function of CAP_PROP_FOURCC?

hi sir,
I have a webcam , its fps in 1280x720 is about 10 .
As I know that the fps can reach to 30 fps if I change VideoCapture’s input format to MJPG.

I used following code in opencv450 without gstreamer and It works fine, the fps in 1280x720 could be about 30

int main()
    VideoCapture video(0);
    std::cout << "MJPG: " << video.set(cv::CAP_PROP_FOURCC, cv::VideoWriter::fourcc('M', 'J', 'P', 'G'));
    cout<<"fps: "<< video.get(CAP_PROP_FPS)<<endl;
    Mat frame;
    while (video.isOpened()) {
    return 0;

Now I updated opencv to latest version (4.5.4) and build WITH_GSTREAMER, and the function

video.set(cv::CAP_PROP_FOURCC, cv::VideoWriter::fourcc('M', 'J', 'P', 'G'));

no longer works . it shows the message:

[ WARN:0] global /media/gino/a278e84d-9197-4f4e-8f2a-3a52677ef946/home/gino/opencv/opencv/modules/videoio/src/cap_gstreamer.cpp (1390) setProperty OpenCV | GStreamer warning: GStreamer: unhandled property

is that means gstreamer disable the CAP_PROP_FOURCC setting function? What should I do to make the correct setting?


There is no such property in gstreamer binding in opencv

and no trace of it in 4.5.0, either

nothing indicates that your earlier test actually used gstreamer.

explicitly pass an apiPreference that is not gstreamer, to avoid using gstreamer.