1
This commit is contained in:
parent
9c8c0768da
commit
b81980eb52
@ -54,38 +54,38 @@ 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 后立刻加“吸震队列”,避免回压把采集端憋死
|
||||||
|
// 关键:h264parse 起名,给你后续要 probe 也能准确找到(但现在先别 probe)
|
||||||
std::string pipeline_str = "v4l2src device=" + cam.device +
|
std::string pipeline_str = "v4l2src device=" + cam.device +
|
||||||
" io-mode=dmabuf "
|
" io-mode=dmabuf do-timestamp=true "
|
||||||
"do-timestamp=true " // ⭐⭐ 正确位置:就在 v4l2src 上
|
|
||||||
|
|
||||||
"! 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 "
|
// ⭐ 吸震:小队列 + upstream 泄漏(丢旧帧,保实时)
|
||||||
|
"! queue max-size-buffers=4 max-size-time=0 leaky=upstream "
|
||||||
|
|
||||||
|
// 你原来的裁剪缩放可以保留
|
||||||
|
"! videocrop top=120 bottom=120 "
|
||||||
"! videoscale "
|
"! 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) +
|
||||||
" "
|
" "
|
||||||
|
|
||||||
"! queue max-size-buffers=12 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) +
|
||||||
" "
|
" "
|
||||||
"gop=30 "
|
"gop=30 header-mode=each-idr profile=main "
|
||||||
"header-mode=each-idr "
|
|
||||||
"profile=main "
|
|
||||||
|
|
||||||
"! 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 "
|
||||||
|
|
||||||
"! flvmux streamable=true "
|
"! flvmux streamable=true "
|
||||||
|
|
||||||
|
// rtmpsink 不要 sync,避免等时钟
|
||||||
"! rtmpsink location=\"" +
|
"! rtmpsink location=\"" +
|
||||||
rtmp_url +
|
rtmp_url + "\" sync=false async=false";
|
||||||
"\" "
|
|
||||||
"sync=false async=false";
|
|
||||||
|
|
||||||
LOG_INFO("[PIPELINE] " + pipeline_str);
|
LOG_INFO("[PIPELINE] " + pipeline_str);
|
||||||
|
|
||||||
@ -97,7 +97,6 @@ GstElement* RTMPManager::create_pipeline(const Camera& cam)
|
|||||||
g_error_free(error);
|
g_error_free(error);
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
return pipeline;
|
return pipeline;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user