Hello, I am trying to use H264 codec using the following initialization for VideoWriter:
VideoWriter writer = VideoWriter("file.mp4", CV_FOURCC('H', '2', '6', '4'), 15, Size(DEFAULT_FRAME_Y, DEFAULT_FRAME_X));
and I run into the following exception:
(myProg:20371): GStreamer-CRITICAL **: gst_element_make_from_uri: assertion 'gst_uri_is_valid (uri)' failed
OpenCV Error: Unspecified error (GStreamer: cannot link elements
) in CvVideoWriter_GStreamer::open, file /path/to/opencv/sources/opencv-3.3/modules/videoio/src/cap_gstreamer.cpp, line 1626
VIDEOIO(cvCreateVideoWriter_GStreamer (filename, fourcc, fps, frameSize, is_color)): raised OpenCV exception:
/path/to/opencv/sources/opencv-3.3/modules/videoio/src/cap_gstreamer.cpp:1626: error: (-2) GStreamer: cannot link elements
in function CvVideoWriter_GStreamer::open
(myProg:20371): GStreamer-CRITICAL **: gst_element_make_from_uri: assertion 'gst_uri_is_valid (uri)' failed
OpenCV Error: Unspecified error (GStreamer: cannot link elements
) in CvVideoWriter_GStreamer::open, file /path/to/opencv/sources/opencv-3.3/modules/videoio/src/cap_gstreamer.cpp, line 1626
VIDEOIO(cvCreateVideoWriter_GStreamer (filename, fourcc, fps, frameSize, is_color)): raised OpenCV exception:
/path/to/opencv/sources/opencv-3.3/modules/videoio/src/cap_gstreamer.cpp:1626: error: (-2) GStreamer: cannot link elements
in function CvVideoWriter_GStreamer::open
The video file is neither created. The command line I use to compile is the following:
cmake -D CMAKE_TOOLCHAIN_FILE=../platforms/linux/gnu.toolchain.cmake \
-D OPENCV_EXTRA_MODULES_PATH=../opencv_contrib/modules/ \
-D CMAKE_INSTALL_PREFIX=${OPENCV_DIR} \
-D WITH_JPEG=OFF \
../ && make -j 8
As I understand after googling a while, it could be an error related to the filename, but I cannot understand what's really wrong with my code.. What is the correct way to initialize VideoWriter object for H264 ?