This commit is contained in:
cxh 2025-10-16 17:58:38 +08:00
parent 8d411c6efe
commit e0a659750a

View File

@ -96,22 +96,16 @@ GstElement *RTMPManager::create_pipeline(const Camera &cam, StreamType type)
std::string stream_name = cam.name + stream_type_suffix(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,width=" + std::to_string(width) +
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) + ",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=" + "! mpph264enc bps=" +
std::to_string(bitrate) + " gop=" + std::to_string(fps) + std::to_string(bitrate) + " gop=" + std::to_string(fps) +
" ! h264parse config-interval=-1 " " ! h264parse ! flvmux name=mux streamable=true "
"! flvmux name=mux streamable=true " "audiotestsrc wave=silence ! audioconvert ! audioresample ! voaacenc ! aacparse ! mux. "
"! queue leaky=downstream max-size-buffers=0 max-size-time=2000000000 max-size-bytes=0 " "mux. ! rtmpsink location=\"rtmp://127.0.0.1/live/" +
"! rtmpsink location=\"rtmp://127.0.0.1/live/" + stream_name + " live=1\" sync=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); LOG_INFO("[RTMP] Creating pipeline for '" + stream_name + "': " + pipeline_str);