Python 读取rtsp时出现Ubuntu OpenCV错误

Python 读取rtsp时出现Ubuntu OpenCV错误,python,opencv,rtsp,Python,Opencv,Rtsp,系统信息(版本) 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 de7

系统信息(版本)

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来连续运行它。代码成功开始运行,并正确读取流,但在短时间内(不是在特定的时间间隔内)会抛出错误,并停止运行。

优化代码格式