2

I am getting rtsp stream from IP camera and then passing the stream in opencv for getting frame, but i am getting distorted frame in that. But when i am using video file instead of rtsp stream frame is not distorted.

import cv2
 video_capture = cv2.VideoCapture("rtsp://ip_address/onvif1")
 while True:
   ret, frame = video_capture.read()
   cv2.imshow('Video', frame)

When streaming directly in vlc player and in ffmpeg frame is not distorting.

This output i am getting when streaming through rtsp using ip camera in opencv

Community
  • 1
  • 1

1 Answers1

0

Credit from : RTSP stream and OpenCV (Python)

You might need to put opencv_ffmpeg.dll in your working directory. Then edit your code like this:

 video_capture = cv.VideoCapture("rtsp://ip_address/onvif1/out.h264") 
    while(1):
    ret, frame = video_capture.read()
    cv.imshow('VIDEO', frame)
    cv.waitKey(1)
Community
  • 1
  • 1
Jimit Vaghela
  • 768
  • 1
  • 8
  • 31