当我运行Python脚本试图显示带有Opencv的VLC RTP流时,控制台中会出现很多错误,并且显示的流质量非常低且不稳定。
import cv2
import numpy as np
cap = cv2.VideoCapture("rtp://224.0.0.1:5004")
while(True):
ret, frame = cap.read()
frame = cv2.flip(frame,1)
gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)
cv2.imshow('frame',gray)
if cv2.waitKey(1) & 0xFF == ord('q'):
break
cap.release()
cv2.destroyAllWindows()
import cv2
import numpy as np
cap = cv2.VideoCapture("rtp://224.0.0.1:5004")
while(True):
ret, frame = cap.read()
frame = cv2.flip(frame,1)
gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)
cv2.imshow('frame',gray)
if cv2.waitKey(1) & 0xFF == ord('q'):
break
cap.release()
cv2.destroyAllWindows()
我想要流畅的输出作为输出,但是对于如何做到这一点没有想法。