Не удается запустить в питоноскрипте картинку через RTSP
Дистрибутив Fedora 28, opencv_version 3.4.1, python 3.6
Подрубаю RTSP-поток так:
cam = cv2.CascadeClassifier("rtsp://admin:888888@192.168.1.40:10544/udp/av0_0")
По урлке ip-видеокамеры. Эта же урл без проблем открывается в VLC
Вылетает ошибка:
VIDEOIO ERROR: V4L: device rtsp://admin:888888@192.168.1.40:10544/udp/av0_0: Unable to query number of channels
OpenCV(3.4.1) Error: Unspecified error (GStreamer: unable to start pipeline
) in cvCaptureFromCAM_GStreamer, file /builddir/build/BUILD/opencv-3.4.1/modules/videoio/src/cap_gstreamer.cpp, line 890
VIDEOIO(cvCreateCapture_GStreamer (CV_CAP_GSTREAMER_FILE, filename)): raised OpenCV exception:
OpenCV(3.4.1) /builddir/build/BUILD/opencv-3.4.1/modules/videoio/src/cap_gstreamer.cpp:890: error: (-2) GStreamer: unable to start pipeline
in function cvCaptureFromCAM_GStreamer
CvCapture_OpenNI::CvCapture_OpenNI : Failed to open input file (rtsp://admin:888888@192.168.1.40:10544/udp/av0_0): Bad file extension
OpenCV(3.4.1) Error: Assertion failed (scn == 3 || scn == 4) in cvtColor, file /builddir/build/BUILD/opencv-3.4.1/modules/imgproc/src/color.cpp, line 11147
Traceback (most recent call last):
File "/mnt/Test/pyface/recognizer.py", line 13, in <module>
gray = cv2.cvtColor(im, cv2.COLOR_BGR2GRAY)
cv2.error: OpenCV(3.4.1) /builddir/build/BUILD/opencv-3.4.1/modules/imgproc/src/color.cpp:11147: error: (-215) scn == 3 || scn == 4 in function cvtColor
Process finished with exit code 1
Особенно смущает «Failed to open input file». Может я как-то не так rtsp-строку ввожу?
Версия OpenCV доступная из Python3 собрана так:
python3 -c "import cv2; print(cv2.getBuildInformation())"
General configuration for OpenCV 3.4.1 =====================================
Version control: unknown
Extra modules:
Location (extra): /builddir/build/BUILD/opencv-3.4.1/opencv_contrib-3.4.1/modules
Version control (extra): unknown
Platform:
Timestamp: 2018-04-16T03:01:29Z
Host: Linux 4.15.3-300.fc27.x86_64 x86_64
CMake: 3.11.0
CMake generator: Unix Makefiles
CMake build tool: /usr/bin/gmake
Configuration: ReleaseWithDebInfo
CPU/HW features:
Baseline: SSE SSE2 SSE3
requested: SSE3
Dispatched code generation: SSE4_1 SSE4_2 FP16 AVX AVX2 AVX512_SKX
requested: SSE4_1 SSE4_2 AVX FP16 AVX2 AVX512_SKX
SSE4_1 (3 files): + SSSE3 SSE4_1
SSE4_2 (1 files): + SSSE3 SSE4_1 POPCNT SSE4_2
FP16 (2 files): + SSSE3 SSE4_1 POPCNT SSE4_2 FP16 AVX
AVX (4 files): + SSSE3 SSE4_1 POPCNT SSE4_2 AVX
AVX2 (8 files): + SSSE3 SSE4_1 POPCNT SSE4_2 FP16 FMA3 AVX AVX2
AVX512_SKX (0 files): + SSSE3 SSE4_1 POPCNT SSE4_2 FP16 FMA3 AVX AVX2 AVX_512F AVX512_SKX
C/C++:
Built as dynamic libs?: YES
C++11: YES
C++ Compiler: /usr/bin/c++ (ver 8.0.1)
C++ flags (Release): -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -mcet -fcf-protection -Wl,--as-needed -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-narrowing -Wno-delete-non-virtual-dtor -Wno-comment -Wno-implicit-fallthrough -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -ffunction-sections -fdata-sections -msse -msse2 -msse3 -fvisibility=hidden -fvisibility-inlines-hidden -fopenmp -DNDEBUG -DNDEBUG
C++ flags (Debug): -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -mcet -fcf-protection -Wl,--as-needed -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-narrowing -Wno-delete-non-virtual-dtor -Wno-comment -Wno-implicit-fallthrough -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -ffunction-sections -fdata-sections -msse -msse2 -msse3 -fvisibility=hidden -fvisibility-inlines-hidden -fopenmp -g -DDEBUG -D_DEBUG
C Compiler: /usr/bin/cc
C flags (Release): -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -mcet -fcf-protection -Wl,--as-needed -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-narrowing -Wno-comment -Wno-implicit-fallthrough -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -ffunction-sections -fdata-sections -msse -msse2 -msse3 -fvisibility=hidden -fopenmp -DNDEBUG -DNDEBUG
C flags (Debug): -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -mcet -fcf-protection -Wl,--as-needed -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-narrowing -Wno-comment -Wno-implicit-fallthrough -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -ffunction-sections -fdata-sections -msse -msse2 -msse3 -fvisibility=hidden -fopenmp -g -DDEBUG -D_DEBUG
Linker flags (Release): -Wl,-z,relro -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld
Linker flags (Debug): -Wl,-z,relro -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld
ccache: NO
Precompiled headers: NO
Extra dependencies: dl pthread rt /lib64/libGL.so /lib64/libGLU.so /lib64/libtbb.so ClpSolver Clp CoinUtils bz2 z m
3rdparty dependencies:
OpenCV modules:
To be built: aruco bgsegm bioinspired calib3d ccalib core cvv datasets dpm face features2d flann freetype fuzzy hdf hfs highgui img_hash imgcodecs imgproc java_bindings_generator line_descriptor ml objdetect optflow phase_unwrapping photo plot python2 python3 python_bindings_generator reg rgbd saliency shape stereo stitching structured_light superres surface_matching tracking ts video videoio videostab ximgproc xobjdetect xphoto
Disabled: js world
Disabled by dependency: dnn_objdetect sfm text
Unavailable: cnn_3dobj cudaarithm cudabgsegm cudacodec cudafeatures2d cudafilters cudaimgproc cudalegacy cudaobjdetect cudaoptflow cudastereo cudawarping cudev java matlab ovis viz
Applications: tests perf_tests examples apps
Documentation: doxygen python
Non-free algorithms: NO
GUI:
QT: YES (ver 5.10.1)
QT OpenGL support: YES (Qt5::OpenGL 5.10.1)
GTK+: NO
OpenGL support: YES (/lib64/libGL.so /lib64/libGLU.so)
VTK support: NO
Media I/O:
ZLib: /lib64/libz.so (ver 1.2.11)
JPEG: /lib64/libjpeg.so (ver )
WEBP: /lib64/libwebp.so (ver encoder: 0x020e)
PNG: /lib64/libpng.so (ver 1.6.34)
TIFF: /lib64/libtiff.so (ver 42 / 4.0.9)
JPEG 2000: /lib64/libjasper.so (ver 2.0.14)
OpenEXR: /lib64/libImath.so /lib64/libIlmImf.so /lib64/libIex.so /lib64/libHalf.so /lib64/libIlmThread.so (ver 2.2.0)
GDAL: YES (/lib64/libgdal.so)
GDCM: YES (ver 2.8.4)
Video I/O:
DC1394: YES (ver 2.2.2)
GStreamer:
base: YES (ver 1.14.0)
video: YES (ver 1.14.0)
app: YES (ver 1.14.0)
riff: YES (ver 1.14.0)
pbutils: YES (ver 1.14.0)
OpenNI: YES (ver 1.5.7, build 10)
OpenNI PrimeSensor Modules: YES (/lib64/libXnCore.so)
UniCap: YES (ver 0.9.12)
UniCap ucil: YES (ver 0.9.10)
libv4l/libv4l2: 1.12.5 / 1.12.5
v4l/v4l2: linux/videodev2.h
Intel Media SDK: NO
gPhoto2: YES
Parallel framework: TBB (ver 2018.0 interface 10002)
Trace: YES (built-in)
Other third-party libraries:
VA: YES
Lapack: YES (/lib64/libopenblas.so)
Eigen: YES (ver 3.3.4)
Custom HAL: NO
Protobuf: /lib64/libprotobuf.so (3.5.0)
NVIDIA CUDA: NO
OpenCL: YES (no extra features)
Include path: /builddir/build/BUILD/opencv-3.4.1/3rdparty/include/opencl/1.2
Link libraries: Dynamic load
Python 2:
Interpreter: /usr/bin/python2.7 (ver 2.7.14)
Libraries: /lib64/libpython2.7.so (ver 2.7.14)
numpy: /usr/lib64/python2.7/site-packages/numpy/core/include (ver 1.14.1)
packages path: lib64/python2.7/site-packages
Python 3:
Interpreter: /usr/bin/python3 (ver 3.6.5)
Libraries: /lib64/libpython3.6m.so (ver 3.6.5)
numpy: /usr/lib64/python3.6/site-packages/numpy/core/include (ver 1.14.1)
packages path: lib64/python3.6/site-packages
Python (for build): /usr/bin/python2.7
Pylint: /usr/bin/pylint (ver: 1.7.5, checks: 116)
Java:
ant: NO
JNI: NO
Java wrappers: NO
Java tests: NO
Matlab: NO
Install to: /usr
-----------------------------------------------------------------
GStreamer плагины установлены. Что ему не хватает?