优化管线

This commit is contained in:
cxh 2025-11-12 17:53:56 +08:00
parent 9dde95485e
commit fe68f9af7a

View File

@ -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;