From 9e088dd2d1784d9b2c42ccab438fd5c1b25a7083 Mon Sep 17 00:00:00 2001 From: haotian <2421912570@qq.com> Date: Tue, 16 Sep 2025 17:32:33 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0zlmediakit=E6=94=AF=E6=8C=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ZLMediaKit | 1 + readme.md | 10 +++++++++- rtsp_processor_1.py | 4 ++-- 3 files changed, 12 insertions(+), 3 deletions(-) create mode 160000 ZLMediaKit diff --git a/ZLMediaKit b/ZLMediaKit new file mode 160000 index 0000000..97d2a1f --- /dev/null +++ b/ZLMediaKit @@ -0,0 +1 @@ +Subproject commit 97d2a1fb08886efcbdbfdf0b59c6d1d6904db450 diff --git a/readme.md b/readme.md index 3a6fb3e..b600e69 100644 --- a/readme.md +++ b/readme.md @@ -1,7 +1,13 @@ # 如何使用 ## 1.启动一个流媒体服务器 ```shell +# 启动nginx-rtmp服务 docker run -d -p 1935:1935 -p 8080:8080 tiangolo/nginx-rtmp +# 或者 +# 启动zlmediakit服务 +sudo su # 切换管理员 +# 注./MediaServer -h 查看参数 +/home/admin-root/haotian/摄像头_目标检测/ZLMediaKit/release/linux/Debug/MediaServer -d --log-slice 10 --log-size 10 & ``` ## 2.启动主服务 ```python @@ -11,5 +17,7 @@ python rtsp_processor.py ```python # 端口号要和服务端口号一致 rtmp://ip:1935/live/processed -http://ip:8080/live/processed.m3u8 +http://ip:port/live/processed.m3u8 +http://ip:port/应用名/流id.live.flv +http://ip:port/应用名/流id/hls.m3u8 ``` diff --git a/rtsp_processor_1.py b/rtsp_processor_1.py index 444f744..cd0994f 100644 --- a/rtsp_processor_1.py +++ b/rtsp_processor_1.py @@ -177,7 +177,7 @@ class AlarmManager: class StreamServer: """流媒体服务器接口""" - def __init__(self, output_url: str = "rtmp://localhost:1935/live/stream", use_gpu: bool = True): + def __init__(self, output_url: str = "rtmp://127.0.0.1:1935/live/stream", use_gpu: bool = True): self.output_url = output_url self.ffmpeg_process = None self.use_gpu = use_gpu @@ -516,7 +516,7 @@ def main(): target_classes=["person", "car", "truck"], # 目标类别 confidence_threshold=0.6, alarm_duration=15, # 告警录制15秒 - cooldown_duration=60, # 冷却60秒 + cooldown_duration=60*60, # 冷却60秒 save_path="./alarm_videos" )