This commit is contained in:
cxh 2025-12-29 14:18:21 +08:00
parent 12b793b658
commit 2b7ff4e056

View File

@ -79,31 +79,22 @@ GstElement* RTMPManager::create_pipeline(const Camera& cam)
std::string pipeline_str = "v4l2src device=" + cam.device +
" io-mode=dmabuf "
"! video/x-raw,format=NV12,"
"width=" +
"! video/x-raw,format=NV12,width=" +
std::to_string(width) + ",height=" + std::to_string(height) +
",framerate=" + std::to_string(fps) +
"/1 "
"! queue max-size-buffers=4 leaky=downstream "
"! queue max-size-buffers=2 leaky=downstream "
"! mpph264enc "
"profile=baseline " // ⭐ 核心:硬性禁 B 帧
"rc-mode=cbr "
"bps=" +
std::to_string(bitrate) +
" "
"gop=" +
std::to_string(fps) +
" " // 1 秒 1 个 IDR
"header-mode=each-idr " // SPS/PPS 跟 IDR
" "
"rc-mode=cbr "
"header-mode=each-idr "
"! h264parse "
"config-interval=1 "
"disable-passthrough=true " // ⭐ 修 DTS
"! queue max-size-buffers=5 leaky=downstream "
"! flvmux streamable=true "
"! rtmpsink location=\"" +
live_rtmp + "\" sync=false async=false";