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

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)