From 8d411c6efeddd29a16c6a37550a918057d264c79 Mon Sep 17 00:00:00 2001 From: cxh Date: Thu, 16 Oct 2025 17:44:53 +0800 Subject: [PATCH] 1 --- src/rtmp_manager.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/rtmp_manager.cpp b/src/rtmp_manager.cpp index 282546d..662c5ed 100644 --- a/src/rtmp_manager.cpp +++ b/src/rtmp_manager.cpp @@ -96,7 +96,7 @@ GstElement *RTMPManager::create_pipeline(const Camera &cam, StreamType type) std::string stream_name = cam.name + stream_type_suffix(type); - // ✅ 注意:只用 sync/async + // ✅ 加入静音音轨 (audiotestsrc wave=silence) std::string pipeline_str = "v4l2src device=" + cam.device + " ! video/x-raw,format=NV12,width=" + std::to_string(width) + ",height=" + std::to_string(height) + ",framerate=" + std::to_string(fps) + @@ -104,10 +104,14 @@ GstElement *RTMPManager::create_pipeline(const Camera &cam, StreamType type) "! mpph264enc bps=" + std::to_string(bitrate) + " gop=" + std::to_string(fps) + " ! h264parse config-interval=-1 " - "! flvmux streamable=true name=mux " + "! flvmux name=mux streamable=true " "! queue leaky=downstream max-size-buffers=0 max-size-time=2000000000 max-size-bytes=0 " "! rtmpsink location=\"rtmp://127.0.0.1/live/" + - stream_name + " live=1\" sync=false async=false"; + stream_name + + " live=1\" sync=false async=false " + // 静音音轨部分 + "audiotestsrc wave=silence ! audioconvert ! audioresample " + "! voaacenc bitrate=64000 ! aacparse ! mux."; LOG_INFO("[RTMP] Creating pipeline for '" + stream_name + "': " + pipeline_str);