3

I have a RTPS streaming camera. The stream works fine when I test it with VLC:

vlc -vvv rtsp://192.168.0.23:554/stream

However with openCV it does not open:

cv::VideoCapture capture; bool ok = capture.open("rtsp://192.168.0.23:554/stream");

returns false.

What can be the reason?

Guilherme Vogt
  • 315
  • 3
  • 10
goaran
  • 353
  • 2
  • 11

4 Answers4

2

I had a similar problem. In my case the dll starts with "opencv_ffmpeg" was missing in the run path.

Nocturne
  • 21
  • 3
  • Guys, this is actually a correct answer! Well maybe there are some other cases, but adding 'opencv_ffmpeg320_64.dll' (chose your version) fixed my case. Thank you – Alexander Lyapin Mar 26 '20 at 19:01
1

If you are using OpenCV 4+ you need to copy the ffmpeg related dll and paste it next to your executable. For example I've built my OpenCV with the BUILD_opencv_world option and I have a file named opencv_videoio_ffmpeg430_64.dll in my bin folder in the my build directory. Without that file it won't open the stream and shows nothing.

max
  • 2,627
  • 1
  • 24
  • 44
-1

When using the VideoCaptuer class with OpenCV 4, in C++, it does not work with RTSP streams.

-2

you can do it by OpenCV and python as below:

import cv2
str1=cv2.VideoCapture("RTSP Address")
while True:
    _,frame=str1.read()
    cv2.imshow('SOMENAME',frame)
    s=cv2.waitkey(0)