1
This commit is contained in:
parent
b81980eb52
commit
57ab5fae7c
@ -54,36 +54,32 @@ GstElement* RTMPManager::create_pipeline(const Camera& cam)
|
|||||||
{
|
{
|
||||||
const std::string rtmp_url = "rtmp://127.0.0.1:1935/" + cam.name;
|
const std::string rtmp_url = "rtmp://127.0.0.1:1935/" + cam.name;
|
||||||
|
|
||||||
// 关键:v4l2src 后立刻加“吸震队列”,避免回压把采集端憋死
|
std::string pipeline_str = "v4l2src name=src device=" + cam.device +
|
||||||
// 关键:h264parse 起名,给你后续要 probe 也能准确找到(但现在先别 probe)
|
" io-mode=dmabuf "
|
||||||
std::string pipeline_str = "v4l2src device=" + cam.device +
|
|
||||||
" io-mode=dmabuf do-timestamp=true "
|
|
||||||
"! video/x-raw,format=NV12,width=1280,height=960,framerate=30/1 "
|
"! video/x-raw,format=NV12,width=1280,height=960,framerate=30/1 "
|
||||||
|
"! videoscale method=nearest-neighbour "
|
||||||
// ⭐ 吸震:小队列 + upstream 泄漏(丢旧帧,保实时)
|
|
||||||
"! queue max-size-buffers=4 max-size-time=0 leaky=upstream "
|
|
||||||
|
|
||||||
// 你原来的裁剪缩放可以保留
|
|
||||||
"! videocrop top=120 bottom=120 "
|
"! videocrop top=120 bottom=120 "
|
||||||
"! videoscale "
|
|
||||||
"! 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) +
|
||||||
" "
|
",pixel-aspect-ratio=1/1 "
|
||||||
|
"! queue max-size-buffers=6 max-size-time=0 max-size-bytes=0 "
|
||||||
// 再来一个队列隔离编码器
|
|
||||||
"! 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(bitrate) +
|
||||||
" "
|
" "
|
||||||
"gop=30 header-mode=each-idr profile=main "
|
"max-bps=" +
|
||||||
|
std::to_string(bitrate) +
|
||||||
"! h264parse name=parse config-interval=1 "
|
" "
|
||||||
|
"min-bps=" +
|
||||||
|
std::to_string(bitrate) +
|
||||||
|
" "
|
||||||
|
"gop=" +
|
||||||
|
std::to_string(fps) +
|
||||||
|
" "
|
||||||
|
"header-mode=each-idr profile=main "
|
||||||
|
"! h264parse config-interval=1 "
|
||||||
"! video/x-h264,stream-format=avc,alignment=au "
|
"! video/x-h264,stream-format=avc,alignment=au "
|
||||||
"! flvmux streamable=true "
|
"! flvmux streamable=true "
|
||||||
|
|
||||||
// rtmpsink 不要 sync,避免等时钟
|
|
||||||
"! rtmpsink location=\"" +
|
"! rtmpsink location=\"" +
|
||||||
rtmp_url + "\" sync=false async=false";
|
rtmp_url + "\" sync=false async=false";
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user