Intel® Distribution of OpenVINO™ Toolkit
Community assistance about the Intel® Distribution of OpenVINO™ toolkit, OpenCV, and all aspects of computer vision-related on Intel® platforms.
6404 Discussions

OpenVINO, OpenCV, FFMPEG on Raspberry4, cant read video or stream

Kulikov__Pavel
Beginner
1,699 Views

Hello, i have a problems with lastest openvino build for raspberry.

My config

raspberry 4, NCS2

I used this link

https://download.01.org/opencv/2019/openvinotoolkit/R3/

And these instructions

https://docs.openvinotoolkit.org/latest/_docs_install_guides_installing_openvino_raspbian.html

 

But i get errors, when im trying to use VideoCapture in cv2 in python, and at the end can't read file

[ WARN:0] global /home/jenkins/workspace/OpenCV/OpenVINO/build/opencv/modules/videoio/src/cap.cpp (92) open VIDEOIO(FFMPEG): trying capture filename='1.avi' ...
[ 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)

 

 

Seems that versions of ffmpeg in system (4.1) and  prebuild opencv2 differ, so it is lead to errors.

 

FFMPEG

pi@raspberrypi:~ $ ffmpeg
ffmpeg version 4.1.4-1+rpt1~deb10u1 Copyright (c) 2000-2019 the FFmpeg developers
  built with gcc 8 (Raspbian 8.3.0-6+rpi1)
  configuration: --prefix=/usr --extra-version='1+rpt1~deb10u1' --toolchain=hardened --libdir=/usr/lib/arm-linux-gnueabihf --incdir=/usr/include/arm-linux-gnueabihf --arch=arm --enable-gpl --disable-stripping --enable-avresample --disable-filter=resample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librsvg --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opengl --enable-sdl2 --enable-omx-rpi --enable-mmal --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libx264 --enable-shared
  libavutil      56. 22.100 / 56. 22.100
  libavcodec     58. 35.100 / 58. 35.100
  libavformat    58. 20.100 / 58. 20.100
  libavdevice    58.  5.100 / 58.  5.100
  libavfilter     7. 40.101 /  7. 40.101
  libavresample   4.  0.  0 /  4.  0.  0
  libswscale      5.  3.100 /  5.  3.100
  libswresample   3.  3.100 /  3.  3.100
  libpostproc    55.  3.100 / 55.  3.100

 

CV2 with openvino:

Video I/O:
    FFMPEG:                      YES
      avcodec:                   YES (57.64.101)
      avformat:                  YES (57.56.101)
      avutil:                    YES (55.34.101)
      swscale:                   YES (4.2.100)
      avresample:                NO
    GStreamer:                   YES (1.10.4)
    v4l/v4l2:                    YES (linux/videodev2.h)

 

 

What should i do to fix it?

Can you make prebuild image for r4?

 

 

 

 

SOLVED:

I guess, it is related with python3.5 that is used for building included OpenCV

 

rebuild and copy to raspberry almost by that link:
https://github.com/opencv/opencv/wiki/Intel's-Deep-Learning-Inference-Engine-backend
 

just need to add in Dockerfile APT INSTALL:

ffmpeg:armhf libavresample-dev:armhf livavcodec-dev:armhf etc.

0 Kudos
2 Replies
JesusE_Intel
Moderator
1,699 Views

Hi Pavel,

Glad you were able to get it to work! Thank you for sharing your solution with the community.

Regards,

Jesus

0 Kudos
Fraccaroli__Michele
1,699 Views

Hi, I've a problem with lastest openvino build for raspberry pi 4 similar to Pavel's problem and I can't find a solution:

On the raspberry I have installed:

- OpenCV 4.1.2-openvino.

- OpenVINO 3.1.

 

I use a simple python script for capture frame from video 'autostrada_1.mp4':

import numpy as np
import cv2 as cv
cap = cv.VideoCapture('autostrada_1.mp4')
while cap.isOpened():
    ret, frame = cap.read()
    # if frame is read correctly ret is True
    if not ret:
        print("Can't receive frame (stream end?). Exiting ...")
        break
    gray = cv.cvtColor(frame, cv.COLOR_BGR2GRAY)
    cv.imshow('frame', gray)
    if cv.waitKey(1) == ord('q'):
        break
cap.release()
cv.destroyAllWindows()

 

And when I run it, this is the output:

[ 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
VIDIOC_REQBUFS: Inappropriate ioctl for device

 

This is my General configuration for OpenCV 4.1.2 - openvino:

General configuration for OpenCV 4.1.2-openvino =====================================
Version control: 9fa6c2ac046f69a7c7c20895bfefd22164b51f19 Platform:
Timestamp: 2019-09-17T15:08:21Z
Host: Linux 4.13.0-45-generic x86_64
Target: Linux 1 armv7l
CMake: 3.7.2
CMake generator: Ninja
CMake build tool: /usr/bin/ninja
Configuration: Release CPU/HW features:
Baseline: NEON
required: NEON
disabled: VFPV3 C/C++:
Built as dynamic libs?: YES
C++ Compiler: /usr/bin/arm-linux-gnueabihf-g++ (ver 6.3.0)
C++ flags (Release): -mthumb -fdata-sections -Wa,--noexecstack -fsigned-char -Wno-psabi -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wuninitialized -Winit-self -Wno-psabi -Wsuggest-override -Wno-delete-non-virtual-dtor -Wno-comment -fdiagnostics-show-option -pthread -fomit-frame-pointer -ffunction-sections -fdata-sections -mfpu=neon -fvisibility=hidden -fvisibility-inlines-hidden -fstack-protector-strong -fPIC -O2 -DNDEBUG -DNDEBUG -D_FORTIFY_SOURCE=2
C++ flags (Debug): -mthumb -fdata-sections -Wa,--noexecstack -fsigned-char -Wno-psabi -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wuninitialized -Winit-self -Wno-psabi -Wsuggest-override -Wno-delete-non-virtual-dtor -Wno-comment -fdiagnostics-show-option -pthread -fomit-frame-pointer -ffunction-sections -fdata-sections -mfpu=neon -fvisibility=hidden -fvisibility-inlines-hidden -fstack-protector-strong -fPIC -g -O0 -DDEBUG -D_DEBUG
C Compiler: /usr/bin/arm-linux-gnueabihf-gcc
C flags (Release): -mthumb -fdata-sections -Wa,--noexecstack -fsigned-char -Wno-psabi -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wuninitialized -Winit-self -Wno-psabi -Wno-comment -fdiagnostics-show-option -pthread -fomit-frame-pointer -ffunction-sections -fdata-sections -mfpu=neon -fvisibility=hidden -fstack-protector-strong -fPIC -O2 -DNDEBUG -DNDEBUG -D_FORTIFY_SOURCE=2
C flags (Debug): -mthumb -fdata-sections -Wa,--noexecstack -fsigned-char -Wno-psabi -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wuninitialized -Winit-self -Wno-psabi -Wno-comment -fdiagnostics-show-option -pthread -fomit-frame-pointer -ffunction-sections -fdata-sections -mfpu=neon -fvisibility=hidden -fstack-protector-strong -fPIC -g -O0 -DDEBUG -D_DEBUG
Linker flags (Release): -Wl,--fix-cortex-a8 -Wl,--no-undefined -Wl,--gc-sections -Wl,-z,noexecstack -Wl,-z,relro -Wl,-z,now -Wl,--gc-sections -z noexecstack -z relro -z now
Linker flags (Debug): -Wl,--fix-cortex-a8 -Wl,--no-undefined -Wl,--gc-sections -Wl,-z,noexecstack -Wl,-z,relro -Wl,-z,now -Wl,--gc-sections -z noexecstack -z relro -z now
ccache: YES
Precompiled headers: NO
Extra dependencies: dl m pthread rt
3rdparty dependencies: OpenCV modules:
To be built: calib3d core dnn features2d flann gapi highgui imgcodecs imgproc ml objdetect photo python2 python3 stitching ts video videoio
Disabled: world
Disabled by dependency: -
Unavailable: java js
Applications: tests perf_tests apps
Documentation: NO
Non-free algorithms: NO GUI:
GTK+: YES (ver 3.22.11)
GThread : YES (ver 2.50.3)
GtkGlExt: NO Media I/O:
ZLib: build (ver 1.2.11)
JPEG: build-libjpeg-turbo (ver 2.0.2-62)
PNG: build (ver 1.6.37)
HDR: YES
SUNRASTER: YES
PXM: YES
PFM: YES Video I/O:
FFMPEG: YES
avcodec: YES (57.64.101)
avformat: YES (57.56.101)
avutil: YES (55.34.101)
swscale: YES (4.2.100)
avresample: NO
GStreamer: YES (1.10.4)
v4l/v4l2: YES (linux/videodev2.h) Parallel framework: pthreads Trace: YES (with Intel ITT) Other third-party libraries:
Inference Engine: YES (2019030000 / 2.1.0)
libs: /home/jenkins/workspace/OpenCV/OpenVINO/build/ie/lib/armv7l/libinference_engine.so
includes: /home/jenkins/workspace/OpenCV/OpenVINO/build/ie/include
Custom HAL: YES (carotene (ver 0.0.1))
Protobuf: build (3.5.1) Python 2:
Interpreter: /usr/bin/python2.7 (ver 2.7.13)
Libraries:
numpy: /usr/lib/python2.7/dist-packages/numpy/core/include (ver undefined - cannot be probed because of the cross-compilation)
install path: /home/jenkins/workspace/OpenCV/OpenVINO/build/build_release/install/python/python2.7 Python 3:
Interpreter: /usr/bin/python3 (ver 3.5.3)
Libraries:
numpy: /usr/lib/python3.5/dist-packages/numpy/core/include (ver undefined - cannot be probed because of the cross-compilation)
install path: /home/jenkins/workspace/OpenCV/OpenVINO/build/build_release/install/python/python3 Python (for build): /usr/bin/python2.7 Install to: /home/jenkins/workspace/OpenCV/OpenVINO/build/build_release/install

 

This script work fine with videoCapture from camera (raspberry camera module v2).

There is a way for fix it?

Thanks for helping me.

0 Kudos
Reply