cv::VideoCapture::get(CAP_PROP_POS_FRAMES) does not work with GStreamer?

asked 2017-12-14 05:06:03 -0600

Until 3.1 I used OpenCV with ffmpeg. Setting and getting the video frame index using CAP_PROP_POS_FRAMES worked without any problems (video cv::VideoCapture::set and ::get).

Now I built OpenCV 3.3.1 with Visual Studio 2015 and GStreamer 1.12.3 (all plugins installed). Videos are read and written without any problems. But as soon as I try to get the video frame index - with the same videos that worked with ffmpeg - it fails:

(cpp-tutorial-bg_sub.exe:13676): GStreamer-CRITICAL **: gst_query_set_position: assertion 'format == g_value_get_enum (gst_structure_id_get_value (s, GST_QUARK (FORMAT)))' failed
warning: Cannot query video position: status=1 value=-1 duration=18795
 (C:\opencv\modules\videoio\src\cap_gstreamer.cpp:949)

The first warning message is from GStreamer (GST_DEBUG=4), the second the subsequent message from OpenCV (see line 948 of cap_gstreamer.cpp)

Above message is from the tutorial project bg_sub. What do I do wrong? Thank you.

edit retag flag offensive close merge delete