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