diff --git a/src/rtmp_manager.cpp b/src/rtmp_manager.cpp index c4e1da9..a75bfd5 100644 --- a/src/rtmp_manager.cpp +++ b/src/rtmp_manager.cpp @@ -71,16 +71,24 @@ GstElement* RTMPManager::create_pipeline(const Camera& cam) std::string pipeline_str = "v4l2src name=src device=" + cam.device + " io-mode=dmabuf " + // ⭐ 相机真实输出:写死 1080p "! video/x-raw,format=NV12," - "width=" + - std::to_string(cam.width) + ",height=" + std::to_string(cam.height) + - ",framerate=" + std::to_string(cam.fps) + + "width=1920,height=1080," + "framerate=" + + std::to_string(cam.fps) + "/1 " - // 🔻 队列深度压到 2 帧(≈ 60ms@30fps) + // ⭐ 关键:在编码前缩放到“推流分辨率” + "! videoscale " + "! video/x-raw," + "width=" + + std::to_string(cam.width) + ",height=" + std::to_string(cam.height) + + " " + + // 🔻 低延时队列 "! queue max-size-buffers=2 max-size-time=0 leaky=downstream " - // 🔻 编码器:baseline + CBR + 无 B 帧 + // 🔻 编码器:SIM 卡友好 "! mpph264enc " "rc-mode=cbr " "bps=" + @@ -92,16 +100,9 @@ GstElement* RTMPManager::create_pipeline(const Camera& cam) "header-mode=each-idr " "profile=baseline " - // SPS/PPS 每秒刷新一次(SRS/WebRTC 友好) "! h264parse config-interval=1 " - - // 🔻 时间戳整形但不强行等待 "! identity sync=false single-segment=true " - - // FLV 最小缓存模式 "! flvmux streamable=true " - - // sink 本身不参与同步 "! rtmpsink location=\"" + live_rtmp + "\" "