Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

OpenCV 3.3 - gstreamer error

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 ?

OpenCV 3.3 - gstreamer error

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. created.
The command line I use to compile OpenCV libraries 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 ?

OpenCV 3.3 - gstreamer error

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 OpenCV libraries 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.. code..
What is the correct way to initialize VideoWriter object for H264 ?

OpenCV 3.3 - gstreamer and libva error

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));
Size(300, 500));

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 OpenCV libraries 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..

EDIT The gstream error seems to be corrected with the following VideoWriter initialization:

VideoWriter writer = VideoWriter("appsrc ! autovideoconvert ! v4l2video1h264enc extra-controls=\"encode,h264_level=10,h264_profile=4,frame_level_rate_control_enable=1,video_bitrate=2000000\" ! h264parse ! rtph264pay config-interval=1 pt=96 ! filesink location=file.mp4", CV_FOURCC('H', '2', '6', '4'), 15, Size(300, 500));

which is taken from here, but now I fall into libva error:

error: XDG_RUNTIME_DIR not set in the environment.
libva info: VA-API version 0.36.0
libva info: va_getDriverName() returns -1
libva error: va_getDriverName() failed with unknown libva error,driver_name=(null)

What is the correct way to initialize VideoWriter object for H264 ?

OpenCV 3.3 - gstreamer and libva error

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(300, 500));

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 OpenCV libraries 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..

EDIT The gstream error seems to be corrected with the following VideoWriter initialization:

VideoWriter writer = VideoWriter("appsrc ! autovideoconvert ! v4l2video1h264enc extra-controls=\"encode,h264_level=10,h264_profile=4,frame_level_rate_control_enable=1,video_bitrate=2000000\" ! h264parse ! rtph264pay config-interval=1 pt=96 ! filesink location=file.mp4", CV_FOURCC('H', '2', '6', '4'), 15, Size(300, 500));

which is taken from here, but now I fall into libva error:

error: XDG_RUNTIME_DIR not set in the environment.
libva info: VA-API version 0.36.0
libva info: va_getDriverName() returns -1
libva error: va_getDriverName() failed with unknown libva error,driver_name=(null)

What is the correct way to initialize VideoWriter object for H264 ?

OpenCV 3.3 - gstreamer and libva error

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(300, 500));

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

The video file is neither created.
The command line I use to compile OpenCV libraries 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..

EDIT The gstream error seems to be corrected with the following VideoWriter initialization:

VideoWriter writer = VideoWriter("appsrc ! autovideoconvert ! v4l2video1h264enc extra-controls=\"encode,h264_level=10,h264_profile=4,frame_level_rate_control_enable=1,video_bitrate=2000000\" ! h264parse ! rtph264pay config-interval=1 pt=96 ! filesink location=file.mp4", CV_FOURCC('H', '2', '6', '4'), 15, Size(300, 500));

which is taken from here, but now I fall into libva error:

error: XDG_RUNTIME_DIR not set in the environment.
libva info: VA-API version 0.36.0
libva info: va_getDriverName() returns -1
libva error: va_getDriverName() failed with unknown libva error,driver_name=(null)

What is the correct way to initialize VideoWriter object for H264 ?