diff --git a/src/rtmp_manager.cpp b/src/rtmp_manager.cpp index 19b7c0b..4cccdd3 100644 --- a/src/rtmp_manager.cpp +++ b/src/rtmp_manager.cpp @@ -59,15 +59,26 @@ GstElement* RTMPManager::create_pipeline(const Camera& cam) std::string pipeline_str = "v4l2src device=" + cam.device + " io-mode=dmabuf " + // 原始输入 "! video/x-raw,format=NV12,width=1280,height=960,framerate=30/1 " + + // 裁剪 + 缩放 "! videocrop top=120 bottom=120 " "! videoscale " + + // ⭐ 关键:在 RAW 阶段强制重打时钟(修复“看着一顿”) + "! videorate " + "! video/x-raw,framerate=30/1 " + + // 输出分辨率 "! video/x-raw,width=" + std::to_string(cam.width) + ",height=" + std::to_string(cam.height) + " " + // 缓冲 "! queue max-size-buffers=8 max-size-time=0 leaky=downstream " + // 编码 "! mpph264enc rc-mode=cbr " "bps=" + std::to_string(cam.bitrate) + @@ -77,9 +88,11 @@ GstElement* RTMPManager::create_pipeline(const Camera& cam) " " "header-mode=each-idr profile=main " + // H264 处理 "! h264parse name=parse config-interval=1 " "! video/x-h264,stream-format=avc,alignment=au " + // RTMP "! flvmux streamable=true " "! rtmpsink location=\"" + rtmp_url + "\" sync=false async=false";