From e0a659750a5077539b42e7b63f1997d00813eabe Mon Sep 17 00:00:00 2001 From: cxh Date: Thu, 16 Oct 2025 17:58:38 +0800 Subject: [PATCH] 1 --- src/rtmp_manager.cpp | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/src/rtmp_manager.cpp b/src/rtmp_manager.cpp index 662c5ed..1c30d43 100644 --- a/src/rtmp_manager.cpp +++ b/src/rtmp_manager.cpp @@ -96,22 +96,16 @@ GstElement *RTMPManager::create_pipeline(const Camera &cam, StreamType type) std::string stream_name = cam.name + stream_type_suffix(type); - // ✅ 加入静音音轨 (audiotestsrc wave=silence) - std::string pipeline_str = "v4l2src device=" + cam.device + - " ! video/x-raw,format=NV12,width=" + std::to_string(width) + + std::string pipeline_str = "v4l2src device=" + cam.device + " ! video/x-raw,width=" + std::to_string(width) + ",height=" + std::to_string(height) + ",framerate=" + std::to_string(fps) + - "/1 ! queue max-size-buffers=1 leaky=downstream " + "/1 " + "! videoconvert ! video/x-raw,format=NV12 " "! mpph264enc bps=" + std::to_string(bitrate) + " gop=" + std::to_string(fps) + - " ! h264parse config-interval=-1 " - "! 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 " - // 静音音轨部分 - "audiotestsrc wave=silence ! audioconvert ! audioresample " - "! voaacenc bitrate=64000 ! aacparse ! mux."; + " ! h264parse ! flvmux name=mux streamable=true " + "audiotestsrc wave=silence ! audioconvert ! audioresample ! voaacenc ! aacparse ! mux. " + "mux. ! rtmpsink location=\"rtmp://127.0.0.1/live/" + + stream_name + " live=1\" sync=false"; LOG_INFO("[RTMP] Creating pipeline for '" + stream_name + "': " + pipeline_str);