python - 读取 rtsp 时出现 Ubuntu OpenCV 错误
问题描述
系统信息(版本)
OpenCV = 4.4.0
操作系统/平台 = Ubuntu
编译器 = Python 3.6.9
使用 RTSP 读取视频流时出现编码错误,如下所示。最初读取过程开始,并且在运行时显示此错误
[hevc @ 0x83b9940] Could not find ref with POC 0
[rtsp @ 0x8325a00] RTP: PT=60: bad cseq ced0 expected=c18a
[rtsp @ 0x8325a00] RTP: PT=60: bad cseq de79 expected=d168
[hevc @ 0x83aefc0] The cu_qp_delta 64 is outside the valid range [-26, 25].
[hevc @ 0x83b9940] Could not find ref with POC 8
[hevc @ 0x83aefc0] CABAC_MAX_BIN : 7
[hevc @ 0x83aefc0] The cu_qp_delta 1094995529 is outside the valid range [-26, 25].
[hevc @ 0x83a05c0] The cu_qp_delta -59 is outside the valid range [-26, 25].
[hevc @ 0x833aa00] The cu_qp_delta 35 is outside the valid range [-26, 25].
代码如下图
cap = cv2.VideoCapture("rtsp://********@192.168.0.46:33/Streaming/Channels/101",cv2.CAP_FFMPEG)
cap.set(cv2.CAP_PROP_FPS,3)
if (cap.isOpened()== False):
print("Error Opening the file")
previous_face = None
# Read until video is completed
while(cap.isOpened()): # Capture frame-by-frame
ret, frame = cap.read()
if(np.shape(frame) != ()):
frame = cv2.resize(frame, (780, 540), interpolation=cv2.INTER_AREA)
cv2.imshow('video', frame)
我们尝试使用 nohup in 连续运行它。代码开始成功运行并正确读取流,但在短时间内(不是在特定时间间隔内)后抛出错误并停止运行。