1
This commit is contained in:
parent
5b0b6c1c65
commit
9c8c0768da
@ -56,26 +56,19 @@ GstElement* RTMPManager::create_pipeline(const Camera& cam)
|
||||
|
||||
std::string pipeline_str = "v4l2src device=" + cam.device +
|
||||
" io-mode=dmabuf "
|
||||
"do-timestamp=true " // ⭐⭐ 正确位置:就在 v4l2src 上
|
||||
|
||||
// ⭐ 强制打时间戳(关键)
|
||||
"! identity do-timestamp=true "
|
||||
|
||||
// 原始 4:3 输入
|
||||
"! video/x-raw,format=NV12,width=1280,height=960,framerate=30/1 "
|
||||
|
||||
// 裁成 16:9
|
||||
"! videocrop top=120 bottom=120 "
|
||||
|
||||
// 缩放到目标分辨率
|
||||
"! videoscale "
|
||||
"! video/x-raw,width=" +
|
||||
std::to_string(cam.width) + ",height=" + std::to_string(cam.height) +
|
||||
" "
|
||||
|
||||
// 缓冲(只在这里允许丢帧)
|
||||
"! queue max-size-buffers=12 max-size-time=0 leaky=downstream "
|
||||
|
||||
// 编码
|
||||
"! mpph264enc rc-mode=cbr "
|
||||
"bps=" +
|
||||
std::to_string(cam.bitrate) +
|
||||
@ -84,12 +77,11 @@ GstElement* RTMPManager::create_pipeline(const Camera& cam)
|
||||
"header-mode=each-idr "
|
||||
"profile=main "
|
||||
|
||||
// 解析 + 帧探针位置
|
||||
"! h264parse name=parse config-interval=1 "
|
||||
"! video/x-h264,stream-format=avc,alignment=au "
|
||||
|
||||
// RTMP
|
||||
"! flvmux streamable=true "
|
||||
|
||||
"! rtmpsink location=\"" +
|
||||
rtmp_url +
|
||||
"\" "
|
||||
|
||||
Loading…
Reference in New Issue
Block a user