Community Blog Buy Now

Misty Community Forum

Using python and openCV to access AV stream

I am trying to display a video frame from Misty’s AV streaming. Below is the python code. It connects to Misty without an error but always returns “Frame is empty” because the return code is false.

Any suggestions on how to make this work?

Thanks for any help.

import cv2

vcap = cv2.VideoCapture(“rtsp://”, cv2.CAP_FFMPEG)
ret, frame =
if ret == False:
print(“Frame is empty”)
cv2.imshow(‘VIDEO’, frame)


Do you have OpenCV with FFMPEG support and was FFMPEG built with RTSP and h.264 support?

It looks like it has FFMPEG support - not sure about h.264 - see details below.

  • FFMPEG:                      YES (prebuilt binaries)

python -c “import cv2; print(cv2.getBuildInformation())”

General configuration for OpenCV 3.4.0 =====================================
Version control: 3.4.0

Timestamp: 2017-12-28T21:46:10Z
Host: Windows 6.3.9600 AMD64
CMake: 3.9.6
CMake generator: Visual Studio 14 2015
CMake build tool: C:/Program Files (x86)/MSBuild/14.0/bin/MSBuild.exe
MSVC: 1900

CPU/HW features:
Baseline: SSE SSE2
requested: SSE2
Dispatched code generation: SSE4_1 SSE4_2 FP16 AVX AVX2
requested: SSE4_1 SSE4_2 AVX FP16 AVX2
SSE4_1 (3 files): + SSE3 SSSE3 SSE4_1
SSE4_2 (1 files): + SSE3 SSSE3 SSE4_1 POPCNT SSE4_2
FP16 (1 files): + SSE3 SSSE3 SSE4_1 POPCNT SSE4_2 FP16 AVX
AVX (5 files): + SSE3 SSSE3 SSE4_1 POPCNT SSE4_2 AVX
AVX2 (9 files): + SSE3 SSSE3 SSE4_1 POPCNT SSE4_2 FP16 FMA3 AVX AVX2

Built as dynamic libs?: NO
C++11: YES
C++ Compiler: C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/cl.exe (ver 19.0.24215.1)
/arch:SSE2 /wd4127 /wd4251 /wd4324 /wd4275 /wd4512 /wd4589 /MP2 /MT /O2 /Ob2 /DNDEBUG /Zi
/arch:SSE2 /wd4127 /wd4251 /wd4324 /wd4275 /wd4512 /wd4589 /MP2 /MTd /Zi /Ob0 /Od /RTC1
C Compiler: C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/cl.exe
C flags (Release): /DWIN32 /D_WINDOWS /W3 /D _CRT_SECURE_NO_DEPRECATE /D _CRT_NONSTDC_NO_DEPRECATE /D _SCL_SECURE_NO_WARNINGS /Gy /bigobj /Oi /fp:fast /arch:SSE /arch:SSE2 /MP2 /MT /O2 /Ob2 /DNDEBUG /Zi
C flags (Debug): /DWIN32 /D_WINDOWS /W3 /D _CRT_SECURE_NO_DEPRECATE /D _CRT_NONSTDC_NO_DEPRECATE /D _SCL_SECURE_NO_WARNINGS /Gy /bigobj /Oi /fp:fast /arch:SSE /arch:SSE2 /MP2 /MTd /Zi /Ob0 /Od /RTC1
Linker flags (Release): /machine:X86 /NODEFAULTLIB:atlthunk.lib /INCREMENTAL:NO /debug /NODEFAULTLIB:libcmtd.lib /NODEFAULTLIB:libcpmtd.lib /NODEFAULTLIB:msvcrtd.lib
Linker flags (Debug): /machine:X86 /NODEFAULTLIB:atlthunk.lib /debug /INCREMENTAL /NODEFAULTLIB:libcmt.lib /NODEFAULTLIB:libcpmt.lib /NODEFAULTLIB:msvcrt.lib
ccache: NO
Precompiled headers: YES
Extra dependencies: comctl32 gdi32 ole32 setupapi ws2_32 vfw32
3rdparty dependencies: ittnotify libprotobuf zlib libjpeg libwebp libpng libtiff libjasper IlmImf ippiw ippicv

OpenCV modules:
To be built: calib3d core dnn features2d flann highgui imgcodecs imgproc ml objdetect photo python3 python_bindings_generator shape stitching superres video videoio videostab
Disabled: js world
Disabled by dependency: -
Unavailable: cudaarithm cudabgsegm cudacodec cudafeatures2d cudafilters cudaimgproc cudalegacy cudaobjdetect cudaoptflow cudastereo cudawarping cudev java python2 ts viz
Applications: apps
Documentation: NO
Non-free algorithms: NO

Windows RT support: NO

Win32 UI: YES
VTK support: NO

Media I/O:
ZLib: build (ver 1.2.11)
JPEG: build (ver 90)
WEBP: build (ver encoder: 0x020e)
PNG: build (ver 1.6.34)
TIFF: build (ver 42 - 4.0.9)
JPEG 2000: build (ver 1.900.1)
OpenEXR: build (ver 1.7.1)

Video I/O:
Video for Windows: YES
DC1394: NO
FFMPEG: YES (prebuilt binaries)
avcodec: YES (ver 57.89.100)
avformat: YES (ver 57.71.100)
avutil: YES (ver 55.58.100)
swscale: YES (ver 4.6.100)
avresample: YES (ver 3.5.0)
GStreamer: NO
DirectShow: YES

Parallel framework: Concurrency

Trace: YES (with Intel ITT)

Other third-party libraries:
Intel IPP: 2017.0.3 [2017.0.3]
at: C:/projects/opencv-python/opencv/build/3rdparty/ippicv/ippicv_win
Intel IPP IW: sources (2017.0.3)
at: C:/projects/opencv-python/opencv/build/3rdparty/ippicv/ippiw_win
Lapack: NO
Eigen: NO
Custom HAL: NO


OpenCL: YES (no extra features)
Include path: C:/projects/opencv-python/opencv/3rdparty/include/opencl/1.2
Link libraries: Dynamic load

Python 3:
Interpreter: C:/Python36/python.exe (ver 3.6.3)
Libraries: C:/Python36/libs/python3*.lib (ver 3.6.3)
numpy: C:/Python36/lib/site-packages/numpy/core/include (ver 1.11.3)
packages path: C:/Python36/Lib/site-packages

Python (for build): C:/Python27/python.exe

ant: NO
JNI: C:/Program Files/Java/jdk1.8.0/include C:/Program Files/Java/jdk1.8.0/include/win32 C:/Program Files/Java/jdk1.8.0/include
Java wrappers: NO
Java tests: NO

Matlab: NO

Install to: C:/projects/opencv-python/opencv/build/install

My suggestion is to make sure you can stream and get data with regular tools like VLC (see instructions: Connecting to Misty's audio/video stream with VLC)

Then try your python + opencv code with a test RTSP stream out there (e.g. rtsp://

Then try to combine the two.

Yes I have tested streaming data to VLC. Now I will try your other suggestions - thanks.