|
|
@@ -117,16 +117,8 @@ class PanoramaCamera:
|
|
|
return True
|
|
|
|
|
|
def start_stream_rtsp(self, rtsp_url: str = None) -> bool:
|
|
|
- """
|
|
|
- 通过RTSP协议获取视频流
|
|
|
- Args:
|
|
|
- rtsp_url: RTSP地址,格式: rtsp://user:pass@ip:port/channel
|
|
|
- Returns:
|
|
|
- 是否成功
|
|
|
- """
|
|
|
if rtsp_url is None:
|
|
|
- # 构建RTSP地址
|
|
|
- rtsp_url = f"rtsp://{self.config['username']}:{self.config['password']}@{self.config['ip']}:{self.config.get('rtsp_port', 554)}/h264/ch{self.config['channel']}/main/av_stream"
|
|
|
+ rtsp_url = self.config.get('rtsp_url') or f"rtsp://{self.config['username']}:{self.config['password']}@{self.config['ip']}:{self.config.get('rtsp_port', 554)}/h264/ch{self.config['channel']}/main/av_stream"
|
|
|
|
|
|
try:
|
|
|
self.rtsp_cap = cv2.VideoCapture(rtsp_url)
|
|
|
@@ -212,8 +204,7 @@ class PanoramaCamera:
|
|
|
time.sleep(0.1)
|
|
|
|
|
|
def _build_rtsp_url(self) -> str:
|
|
|
- """构建 RTSP URL"""
|
|
|
- return f"rtsp://{self.config['username']}:{self.config['password']}@{self.config['ip']}:{self.config.get('rtsp_port', 554)}/h264/ch{self.config['channel']}/main/av_stream"
|
|
|
+ return self.config.get('rtsp_url') or f"rtsp://{self.config['username']}:{self.config['password']}@{self.config['ip']}:{self.config.get('rtsp_port', 554)}/h264/ch{self.config['channel']}/main/av_stream"
|
|
|
|
|
|
def _rtsp_stream_worker(self):
|
|
|
"""RTSP视频流工作线程"""
|