From fe68f9af7a9e5a344d3c720a8adc9b8038adc10b Mon Sep 17 00:00:00 2001 From: cxh Date: Wed, 12 Nov 2025 17:53:56 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E7=AE=A1=E7=BA=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/rtmp_manager.cpp | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/src/rtmp_manager.cpp b/src/rtmp_manager.cpp index 5aff5b1..3348566 100644 --- a/src/rtmp_manager.cpp +++ b/src/rtmp_manager.cpp @@ -81,15 +81,20 @@ GstElement* RTMPManager::create_pipeline(const Camera& cam) ",framerate=" + std::to_string(fps) + "/1 ! " "tee name=t " - "t. ! queue max-size-buffers=5 leaky=downstream ! " + // 主分支:编码 + RTMP 推流 + "t. ! queue ! " "mpph264enc bps=" + std::to_string(bitrate) + " gop=" + std::to_string(fps) + - " rc-mode=cbr ! " + " ! " "h264parse ! flvmux streamable=true name=mux " - "audiotestsrc wave=silence ! audioconvert ! audioresample ! voaacenc ! aacparse ! mux. " - "mux. ! rtmpsink location=\"" + + // 静音音频轨道(避免 RTMP 播放器报错) + "audiotestsrc wave=silence ! audioconvert ! audioresample ! " + "voaacenc ! aacparse ! mux. " + // 输出 RTMP + "mux. ! rtmpsink name=sink location=\"" + location + - "\" sync=false async=false " + "\" sync=false " + // 第二分支:预留 (AI 分析/录制) "t. ! queue ! fakesink sync=false"; GError* error = nullptr;