Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
329 Views

VideoIO not working with OpenVINO

Hi,

I'm seeking help because i'm not able to use cv2.VideoCapture() to read video files with OpenVINO.
I first used normal OpenCV with only FFMPEG support and it works fine. With OpenVINO not even with GStreamer it loads.
Everything else other than opening video files seems to work fine (I'm yet to try a camera).

So, before posting this I searched for someone with similar problems and I found no (working) solution.
I used opencv env variables to get more information about the problem and I'll leave it bellow.

I'm using a Raspberry Pi 4 with Raspbian. Version: '4.1.2-openvino'

 

[ INFO:0] global /home/jenkins/workspace/OpenCV/OpenVINO/build/opencv/modules/videoio/src/videoio_registry.cpp (187) VideoBackendRegistry VIDEOIO: Enabled backends(6, sorted by priority): FFMPEG(1000); GSTREAMER(990); INTEL_MFX(980); V4L2(970); CV_IMAGES(960); CV_MJPEG(950)
[ WARN:0] global /home/jenkins/workspace/OpenCV/OpenVINO/build/opencv/modules/videoio/src/cap.cpp (92) open VIDEOIO(FFMPEG): trying capture filename='./input/1.AVI' ...
[ INFO:0] global /home/jenkins/workspace/OpenCV/OpenVINO/build/opencv/modules/videoio/src/backend_plugin.cpp (329) getPluginCandidates VideoIO pluigin (FFMPEG): glob is 'libopencv_videoio_ffmpeg*.so', 1 location(s)
[ INFO:0] global /home/jenkins/workspace/OpenCV/OpenVINO/build/opencv/modules/videoio/src/backend_plugin.cpp (336) getPluginCandidates     - /home/pi/openvino/opencv/lib: 1
[ INFO:0] global /home/jenkins/workspace/OpenCV/OpenVINO/build/opencv/modules/videoio/src/backend_plugin.cpp (340) getPluginCandidates Found 1 plugin(s) for FFMPEG
[ INFO:0] global /home/jenkins/workspace/OpenCV/OpenVINO/build/opencv/modules/videoio/src/backend_plugin.cpp (172) libraryLoad load /home/pi/openvino/opencv/lib/libopencv_videoio_ffmpeg.so => FAILED
[ WARN:0] global /home/jenkins/workspace/OpenCV/OpenVINO/build/opencv/modules/videoio/src/cap.cpp (128) open VIDEOIO(FFMPEG): backend is not available (plugin is missing, or can't be loaded due dependencies or it is not compatible)
[ WARN:0] global /home/jenkins/workspace/OpenCV/OpenVINO/build/opencv/modules/videoio/src/cap.cpp (92) open VIDEOIO(GSTREAMER): trying capture filename='./input/1.AVI' ...
[ INFO:0] global /home/jenkins/workspace/OpenCV/OpenVINO/build/opencv/modules/videoio/src/backend_plugin.cpp (329) getPluginCandidates VideoIO pluigin (GSTREAMER): glob is 'libopencv_videoio_gstreamer*.so', 1 location(s)
[ INFO:0] global /home/jenkins/workspace/OpenCV/OpenVINO/build/opencv/modules/videoio/src/backend_plugin.cpp (336) getPluginCandidates     - /home/pi/openvino/opencv/lib: 1
[ INFO:0] global /home/jenkins/workspace/OpenCV/OpenVINO/build/opencv/modules/videoio/src/backend_plugin.cpp (340) getPluginCandidates Found 1 plugin(s) for GSTREAMER
[ INFO:0] global /home/jenkins/workspace/OpenCV/OpenVINO/build/opencv/modules/videoio/src/backend_plugin.cpp (172) libraryLoad load /home/pi/openvino/opencv/lib/libopencv_videoio_gstreamer.so => OK
[ INFO:0] global /home/jenkins/workspace/OpenCV/OpenVINO/build/opencv/modules/videoio/src/backend_plugin.cpp (220) PluginBackend Video I/O: loaded plugin 'GStreamer OpenCV Video I/O plugin'
[ WARN:0] global /home/jenkins/workspace/OpenCV/OpenVINO/build/opencv/modules/videoio/src/cap_gstreamer.cpp (480) isPipelinePlaying OpenCV | GStreamer warning: GStreamer: pipeline have not been created
[ WARN:0] global /home/jenkins/workspace/OpenCV/OpenVINO/build/opencv/modules/videoio/src/cap.cpp (112) open VIDEOIO(GSTREAMER): can't create capture
[ WARN:0] global /home/jenkins/workspace/OpenCV/OpenVINO/build/opencv/modules/videoio/src/cap.cpp (92) open VIDEOIO(INTEL_MFX): trying capture filename='./input/1.AVI' ...
[ INFO:0] global /home/jenkins/workspace/OpenCV/OpenVINO/build/opencv/modules/videoio/src/backend_plugin.cpp (329) getPluginCandidates VideoIO pluigin (INTEL_MFX): glob is 'libopencv_videoio_intel_mfx*.so', 1 location(s)
[ INFO:0] global /home/jenkins/workspace/OpenCV/OpenVINO/build/opencv/modules/videoio/src/backend_plugin.cpp (336) getPluginCandidates     - /home/pi/openvino/opencv/lib: 0
[ INFO:0] global /home/jenkins/workspace/OpenCV/OpenVINO/build/opencv/modules/videoio/src/backend_plugin.cpp (340) getPluginCandidates Found 0 plugin(s) for INTEL_MFX
[ WARN:0] global /home/jenkins/workspace/OpenCV/OpenVINO/build/opencv/modules/videoio/src/cap.cpp (128) open VIDEOIO(INTEL_MFX): backend is not available (plugin is missing, or can't be loaded due dependencies or it is not compatible)
[ WARN:0] global /home/jenkins/workspace/OpenCV/OpenVINO/build/opencv/modules/videoio/src/cap.cpp (92) open VIDEOIO(V4L2): trying capture filename='./input/1.AVI' ...
VIDIOC_REQBUFS: Inappropriate ioctl for device
[ WARN:0] global /home/jenkins/workspace/OpenCV/OpenVINO/build/opencv/modules/videoio/src/cap.cpp (112) open VIDEOIO(V4L2): can't create capture
[ WARN:0] global /home/jenkins/workspace/OpenCV/OpenVINO/build/opencv/modules/videoio/src/cap.cpp (92) open VIDEOIO(CV_IMAGES): trying capture filename='./input/1.AVI' ...
[ INFO:0] global /home/jenkins/workspace/OpenCV/OpenVINO/build/opencv/modules/videoio/src/cap_images.cpp (282) icvExtractPattern Pattern: ./input/%01d.AVI @ 1
[ INFO:0] global /home/jenkins/workspace/OpenCV/OpenVINO/build/opencv/modules/videoio/src/cap_images.cpp (313) open CAP_IMAGES: Stop scanning. Can't read image file: ./input/1.AVI
[ WARN:0] global /home/jenkins/workspace/OpenCV/OpenVINO/build/opencv/modules/videoio/src/cap.cpp (104) open VIDEOIO(CV_IMAGES): created, isOpened=0
[ WARN:0] global /home/jenkins/workspace/OpenCV/OpenVINO/build/opencv/modules/videoio/src/cap.cpp (92) open VIDEOIO(CV_MJPEG): trying capture filename='./input/1.AVI' ...
[ WARN:0] global /home/jenkins/workspace/OpenCV/OpenVINO/build/opencv/modules/videoio/src/cap.cpp (112) open VIDEOIO(CV_MJPEG): can't create capture

0 Kudos
7 Replies
Highlighted
329 Views

Hi Emanuel,

The issue might be due to gstreamer plugin. Can you try installing the gstreamer plugins.

Hope this helps.

Regards,

Ram prasad

0 Kudos
Highlighted
Employee
329 Views

Looks like you don't have FFmpeg installed or your FFmpeg version is not compatible. This build of OpenCV should be compatible with Raspbian 9.

I assume your GStreamer backend does not work either due to a bug with broken support of relative file paths, try to use absolute path or get latest OpenVINO version where this bug should be fixed.

0 Kudos
Highlighted
329 Views

Ram prasad (Intel) wrote:

Hi Emanuel,

The issue might be due to gstreamer plugin. Can you try installing the gstreamer plugins.

Hope this helps.

Regards,

Ram prasad

Hi

Sorry, I should've given this information earlier but I had Gstreamer plugins installed in my post, these are the versions:
gstreamer1.0-plugins-bad/stable,now 1.14.4-1+b1 armhf [installed]
gstreamer1.0-plugins-base/stable,now 1.14.4-2 armhf [installed]
gstreamer1.0-plugins-good/testing,now 1.14.4-1+rpt1 armhf [installed]

Thank you for your help

Maksim S. (Intel) wrote:

Looks like you don't have FFmpeg installed or your FFmpeg version is not compatible. This build of OpenCV should be compatible with Raspbian 9.

I assume your GStreamer backend does not work either due to a bug with broken support of relative file paths, try to use absolute path or get latest OpenVINO version where this bug should be fixed.

Hi

I had this FFmpeg version in my post:
ffmpeg/testing,now 7:4.1.4-1+rpt7~deb10u1 armhf [installed]

But my Raspbian version is 10 so maybe that's the problem? It's weird because in my OpenCV build it works fine.
I would like to avoid a downgrade so I tried to fix Gstreamer instead.
I downloaded OpenVINO latest version and Gstreamer continues not to work but with a different problem now:

[ INFO:0] global ../opencv/modules/videoio/src/cap_gstreamer.cpp (690) open OpenCV | GStreamer: ./input/1.AVI
[ INFO:0] global ../opencv/modules/videoio/src/cap_gstreamer.cpp (723) open OpenCV | GStreamer: mode - FILE
[ WARN:0] global ../opencv/modules/videoio/src/cap_gstreamer.cpp (1759) handleMessage OpenCV | GStreamer warning: Embedded video playback halted; module v4l2jpegdec0 reported: No valid frames decoded before end of stream
[DEBUG:0] global ../opencv/modules/videoio/src/cap_gstreamer.cpp (1760) handleMessage GStreamer debug: gstvideodecoder.c(1161): gst_video_decoder_sink_event_default (): /GstPipeline:pipeline0/GstURIDecodeBin:uridecodebin0/GstDecodeBin:decodebin0/v4l2jpegdec:v4l2jpegdec0:
no valid frames found
[ WARN:0] global ../opencv/modules/videoio/src/cap_gstreamer.cpp (888) open OpenCV | GStreamer warning: unable to start pipeline

Build Informtion says: v4l/v4l2:                    YES (linux/videodev2.h)
 

The idea I get from this is that my video file is not good? But that's impossible because as I said my OpenCV build read it fine and I can watch it too.

Thank you for your help

0 Kudos
Highlighted
Employee
329 Views

ffmpeg/testing,now 7:4.1.4-1+rpt7~deb10u1 armhf [installed]

Raspbian 9 has FFmpeg 3.x and OpenCV in OpenVINO is linked to version 3.x, it can not load version 4.x because it is incompatible. This is related message: "libraryLoad load /home/pi/openvino/opencv/lib/libopencv_videoio_ffmpeg.so => FAILED" Your OpenCV build work because when you built it on your platform it linked with FFmpeg 4.x and was able to use this backend.

[ INFO:0] global ../opencv/modules/videoio/src/cap_gstreamer.cpp (690) open OpenCV | GStreamer: ./input/1.AVI

Please try to use absolute file path.

0 Kudos
Highlighted
329 Views

Maksim S. (Intel) wrote:

ffmpeg/testing,now 7:4.1.4-1+rpt7~deb10u1 armhf [installed]

Raspbian 9 has FFmpeg 3.x and OpenCV in OpenVINO is linked to version 3.x, it can not load version 4.x because it is incompatible. This is related message: "libraryLoad load /home/pi/openvino/opencv/lib/libopencv_videoio_ffmpeg.so => FAILED" Your OpenCV build work because when you built it on your platform it linked with FFmpeg 4.x and was able to use this backend.

[ INFO:0] global ../opencv/modules/videoio/src/cap_gstreamer.cpp (690) open OpenCV | GStreamer: ./input/1.AVI

Please try to use absolute file path.

 

Same error using absolute file path

[ INFO:0] global ../opencv/modules/videoio/src/cap_gstreamer.cpp (690) open OpenCV | GStreamer: /home/pi/AI-Counter/AI-Counter_            min/input/1.AVI
[ INFO:0] global ../opencv/modules/videoio/src/cap_gstreamer.cpp (723) open OpenCV | GStreamer: mode - FILE
[ WARN:0] global ../opencv/modules/videoio/src/cap_gstreamer.cpp (1759) handleMessage OpenCV | GStreamer warning: Embedded vide            o playback halted; module v4l2jpegdec0 reported: No valid frames decoded before end of stream
[DEBUG:0] global ../opencv/modules/videoio/src/cap_gstreamer.cpp (1760) handleMessage GStreamer debug: gstvideodecoder.c(1161):             gst_video_decoder_sink_event_default (): /GstPipeline:pipeline0/GstURIDecodeBin:uridecodebin0/GstDecodeBin:decodebin0/v4l2jpeg            dec:v4l2jpegdec0:
no valid frames found

 

About FFmpeg:
Following that logic if I download ffmpeg v3.x I should be able to use FFmpeg?  I'll try

0 Kudos
Highlighted
329 Views

Update: 
I found out that i can't use FFmpeg anyway with this build so I wish someone could help me with this Gstreamer problem

 

Thank you

 

Edit: Found out that .mov and .mp4 files work maybe only .avi don't work? possible bug?

 

0 Kudos
Highlighted
Employee
329 Views

Unfortunately it is not easy to determine root cause of the problem. GStreamer is a complex framework with dozens of plugins which are used to build complex video processing pipelines. Looks like in your case something is wrong with MJPEG decoding performed via V4L2 interface, it can be caused by missing drivers or packages, or configuration issues. Take a look at this similar problem: https://www.raspberrypi.org/forums/viewtopic.php?t=249377

You can also try to play your file using gst-play util to check whether it works: https://manpages.ubuntu.com/manpages/artful/en/man1/gst-play-1.0.1.html

 

0 Kudos