When using OpenCV (4.1.1) on a jetson AGX Xavier and implementing the cap_prop_fourcc command to alter the video streams format the following warning shows up and crashes the program:
It seems as if the file cap_gstreamer.cpp could not be located, which is very well possible as the automatically specified path shown in the image above does not exist. The particular file does exist somewhere else on the system however, though I am unable to find any possibility to change the path at which the file is searched.
I require the gstreamer property for the VideoWriter handle in OpenCV as OpenCV auto loads my webcam stream in YUYV format, and i require the webcams MJPG format.
unfortunately this did not solve anything for me. I have attempted doing a fresh install prior as well, with no success however.
It did, however change the path at which it searches for the cap_gstreamer.cpp file. While the file is now present at the specified path I get exactly the same warning (unhandled property)
Hi,
Looks like the issue is not in building OpenCV but in running an OpenCV application? There is a sample demonstrating VideoCapture() and VideoWriter():
I have resolved my own issue after trying out several possibilities and stumbling on the solution.
In order to be able to change the format of the webcam image you need a different backend, OpenCV automatically loads the first backend it finds. When you ‘force’ this to be the V4L2 backend by changing the following line:
cap = new cv::VideoCapture(index, cv::CAP_V4L2);
The warnings dissapear and the image is processed properly.
@DaneLLL thank you very much for the quick responses and support today!
The first warning is normal. A live stream has no duration so current position cannot be computed.
The second says you are trying to set an unsupported property for this capture device.
It looks surprizing you are using videoWriter::fourcc for a video capture.
Anyway for a MJPG camera, you would use gstreamer API leveraging HW decoder rather than V4L API:
If this doesn’t work, try adding jpegparse between v4l2src and nvv4l2decoder.
If it works but with low framerate, try adding option io-mode=2 to v4l2src.