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.
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)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.