Не удалось найти RTSP-URL моей камеры при использовании opencv-python

#python #opencv #rtsp #opencv-python

Вопрос:

Я использую модель MatrixIPCamera: камера SATATYA CIDR20FL36CWS, с которой я хочу записывать видео в свой код python.

Я использую:

 import cv2 import os camera = "rtsp://lt;usernamegt;:lt;passwordgt;@lt;Ip addressgt;:lt;Portgt;/Streaming/Channels/2/"  video = cv2.VideoCapture(camera)  

Но каждый раз, когда я получаю:

 [ERROR:0] global /tmp/pip-req-build-l1r0y34w/opencv/modules/videoio/src/cap.cpp (160) open VIDEOIO(CV_IMAGES): raised OpenCV exception:  OpenCV(4.5.3) /tmp/pip-req-build-l1r0y34w/opencv/modules/videoio/src/cap_images.cpp:253: error: (-5:Bad argument) CAP_IMAGES: can't find starting number (in the name of file): rtsp://lt;usernamegt;:lt;passwordgt;@lt;Ip addressgt;:lt;Portgt;/Streaming/Channels/2/ in function 'icvExtractPattern'  

Результаты печати(cv.getBuildInformation())

 General configuration for OpenCV 4.5.3 =====================================  Version control: 4.5.3-dirty   Platform:  Timestamp: 2021-07-09T11:59:03Z  Host: Linux 5.8.0-1036-azure x86_64  CMake: 3.20.5  CMake generator: Unix Makefiles  CMake build tool: /bin/gmake  Configuration: Release   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 (15 files):   SSSE3 SSE4_1  SSE4_2 (1 files):   SSSE3 SSE4_1 POPCNT SSE4_2  FP16 (0 files):   SSSE3 SSE4_1 POPCNT SSE4_2 FP16 AVX  AVX (4 files):   SSSE3 SSE4_1 POPCNT SSE4_2 AVX  AVX2 (29 files):   SSSE3 SSE4_1 POPCNT SSE4_2 FP16 FMA3 AVX AVX2  AVX512_SKX (4 files):   SSSE3 SSE4_1 POPCNT SSE4_2 FP16 FMA3 AVX AVX2 AVX_512F AVX512_COMMON AVX512_SKX   C/C  :  Built as dynamic libs?: NO  C   standard: 11  C   Compiler: /usr/lib/ccache/compilers/c   (ver 9.3.1)  C   flags (Release): -Wl,-strip-all -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 -Wsuggest-override -Wno-delete-non-virtual-dtor -Wno-comment -Wimplicit-fallthrough=3 -Wno-strict-overflow -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -ffunction-sections -fdata-sections -msse -msse2 -msse3 -fvisibility=hidden -fvisibility-inlines-hidden -O3 -DNDEBUG -DNDEBUG  C   flags (Debug): -Wl,-strip-all -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 -Wsuggest-override -Wno-delete-non-virtual-dtor -Wno-comment -Wimplicit-fallthrough=3 -Wno-strict-overflow -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -ffunction-sections -fdata-sections -msse -msse2 -msse3 -fvisibility=hidden -fvisibility-inlines-hidden -g -O0 -DDEBUG -D_DEBUG  C Compiler: /usr/lib/ccache/compilers/cc  C flags (Release): -Wl,-strip-all -fsigned-char -W -Wall -Werror=return-type -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wuninitialized -Wno-comment -Wimplicit-fallthrough=3 -Wno-strict-overflow -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -ffunction-sections -fdata-sections -msse -msse2 -msse3 -fvisibility=hidden -O3 -DNDEBUG -DNDEBUG  C flags (Debug): -Wl,-strip-all -fsigned-char -W -Wall -Werror=return-type -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wuninitialized -Wno-comment -Wimplicit-fallthrough=3 -Wno-strict-overflow -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -ffunction-sections -fdata-sections -msse -msse2 -msse3 -fvisibility=hidden -g -O0 -DDEBUG -D_DEBUG  Linker flags (Release): -Wl,--exclude-libs,libippicv.a -Wl,--exclude-libs,libippiw.a -L/root/ffmpeg_build/lib -Wl,--gc-sections -Wl,--as-needed   Linker flags (Debug): -Wl,--exclude-libs,libippicv.a -Wl,--exclude-libs,libippiw.a -L/root/ffmpeg_build/lib -Wl,--gc-sections -Wl,--as-needed   ccache: YES  Precompiled headers: NO  Extra dependencies: Qt5::Core Qt5::Gui Qt5::Widgets Qt5::Test Qt5::Concurrent /lib64/libpng.so /lib64/libz.so dl m pthread rt  3rdparty dependencies: libprotobuf ade ittnotify libjpeg-turbo libwebp libtiff libopenjp2 IlmImf quirc ippiw ippicv   OpenCV modules:  To be built: calib3d core dnn features2d flann gapi highgui imgcodecs imgproc ml objdetect photo python3 stitching video videoio  Disabled: world  Disabled by dependency: -  Unavailable: java python2 ts  Applications: -  Documentation: NO  Non-free algorithms: NO   GUI:   QT: YES (ver 5.15.0)  QT OpenGL support: NO  GTK : NO  VTK support: NO   Media I/O:   ZLib: /lib64/libz.so (ver 1.2.7)  JPEG: libjpeg-turbo (ver 2.1.0-62)  WEBP: build (ver encoder: 0x020f)  PNG: /lib64/libpng.so (ver 1.5.13)  TIFF: build (ver 42 - 4.2.0)  JPEG 2000: build (ver 2.4.0)  OpenEXR: build (ver 2.3.0)  HDR: YES  SUNRASTER: YES  PXM: YES  PFM: YES   Video I/O:  DC1394: NO  FFMPEG: YES  avcodec: YES (58.109.100)  avformat: YES (58.61.100)  avutil: YES (56.60.100)  swscale: YES (5.8.100)  avresample: NO  GStreamer: NO  v4l/v4l2: YES (linux/videodev2.h)   Parallel framework: pthreads   Trace: YES (with Intel ITT)   Other third-party libraries:  Intel IPP: 2020.0.0 Gold [2020.0.0]  at: /tmp/pip-req-build-l1r0y34w/_skbuild/linux-x86_64-3.7/cmake-build/3rdparty/ippicv/ippicv_lnx/icv  Intel IPP IW: sources (2020.0.0)  at: /tmp/pip-req-build-l1r0y34w/_skbuild/linux-x86_64-3.7/cmake-build/3rdparty/ippicv/ippicv_lnx/iw  VA: NO  Lapack: NO  Eigen: NO  Custom HAL: NO  Protobuf: build (3.5.1)   OpenCL: YES (no extra features)  Include path: /tmp/pip-req-build-l1r0y34w/opencv/3rdparty/include/opencl/1.2  Link libraries: Dynamic load   Python 3:  Interpreter: /opt/python/cp37-cp37m/bin/python (ver 3.7.9)  Libraries: libpython3.7m.a (ver 3.7.9)  numpy: /tmp/pip-build-env-r4l7zyhq/overlay/lib/python3.7/site-packages/numpy/core/include (ver 1.14.5)  install path: python   Python (for build): /bin/python2.7   Java:   ant: NO  JNI: NO  Java wrappers: NO  Java tests: NO   Install to: /tmp/pip-req-build-l1r0y34w/_skbuild/linux-x86_64-3.7/cmake-install -----------------------------------------------------------------   

Похоже, GStreamer пропал. ………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………..

Комментарии:

1. Можете ли вы получить доступ к тому же URL-адресу с помощью видеоплеера VLC?

2. print(cv.getBuildInformation()) и добавьте в свой пост. скорее всего, вам не хватает gstreamer.

3. @Micka Нет, я не могу получить доступ к тому же URL-адресу с помощью VLC

4. Добавил @ChristophRackwitz. Пожалуйста, проверьте правку.

5. Вы заменили lt;содержаниеgt; фактической информацией, верно?