mgu*_*che 5 python logging opencv ffmpeg h.264
我有以下脚本,我使用 OpenCV 从 Python3 读取 RTSP 流。
cap = cv2.VideoCapture(ID)
ret, frame = cap.read()
这些流使用 h264 进行编码,我收到大量警告和错误消息。
[h264 @ 0x7f74cc430c80] co located POCs unavailable
[h264 @ 0x7f74b4258160] error while decoding MB 38 2, bytestream -19
我尝试使用上下文管理器来重定向 stdout 和 stderr 让它们保持沉默,但没有成功:
class SilenceOutput(object):
def __enter__(self):
self._original_stdout = sys.stdout
self._original_stderr = sys.stderr
sys.stdout = None
sys.stderr = None
def __exit__(self, exc_type, exc_val, exc_tb):
sys.stdout = self._original_stdout
sys.stderr = self._original_stderr
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
2812 次 |
最近记录: |