From 5ce30af0bb512b41e2863f6daf2165e011f70078 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=80=E5=96=B5?= Date: Wed, 1 Jul 2026 09:33:56 +0800 Subject: [PATCH] =?UTF-8?q?2026.7.1=E5=B0=8F=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- infer_camera_modular.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/infer_camera_modular.py b/infer_camera_modular.py index d1f0ab6..f2c6f72 100644 --- a/infer_camera_modular.py +++ b/infer_camera_modular.py @@ -162,8 +162,10 @@ class VideoStreaming: if self.is_rtsp: # 设置 RTSP 缓冲区大小(只保留 1 帧,降低延迟) self.cap.set(cv2.CAP_PROP_BUFFERSIZE, 1) - self.cap.set(cv2.CAP_PROP_FOURCC, - cv2.VideoWriter_fourcc('H', '2', '6', '4')) + try: + self.cap.set(cv2.CAP_PROP_FOURCC, cv2.VideoWriter_fourcc('H', '2', '6', '4')) + except Exception: + pass # 编码设置失败不影响连接 if "?" not in self.video_source: self.video_source += "?tcp" else: