简体   繁体   中英

Distorted frame when using rtsp stream from IP with opencv camera in python

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.

我在opencv中使用ip camera通过rtsp流式传输时得到的输出

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM