1
This commit is contained in:
parent
3832cee181
commit
363e33a3cc
@ -68,35 +68,38 @@ GstElement* RTMPManager::create_pipeline(const Camera& cam)
|
|||||||
|
|
||||||
const std::string live_rtmp = "rtmp://36.153.162.171:19435/" + app + "/" + stream + "?vhost=live";
|
const std::string live_rtmp = "rtmp://36.153.162.171:19435/" + app + "/" + stream + "?vhost=live";
|
||||||
|
|
||||||
std::string pipeline_str = "v4l2src device=" + cam.device +
|
std::string pipeline_str = "v4l2src name=src device=" + cam.device +
|
||||||
" io-mode=dmabuf "
|
" io-mode=dmabuf "
|
||||||
|
|
||||||
"! video/x-raw,format=NV12,"
|
"! video/x-raw,format=NV12,"
|
||||||
"width=" +
|
"width=" +
|
||||||
std::to_string(width) + ",height=" + std::to_string(height) +
|
std::to_string(cam.width) + ",height=" + std::to_string(cam.height) +
|
||||||
",framerate=" + std::to_string(fps) +
|
",framerate=" + std::to_string(cam.fps) +
|
||||||
"/1 "
|
"/1 "
|
||||||
|
|
||||||
"! queue max-size-buffers=4 leaky=downstream "
|
"! queue max-size-buffers=4 max-size-time=0 leaky=downstream "
|
||||||
|
|
||||||
"! mpph264enc "
|
"! mpph264enc "
|
||||||
"rc-mode=cbr "
|
"rc-mode=cbr "
|
||||||
"bps=" +
|
"bps=" +
|
||||||
std::to_string(bitrate) +
|
std::to_string(cam.bitrate) +
|
||||||
" "
|
" "
|
||||||
"gop=" +
|
"gop=" +
|
||||||
std::to_string(fps) +
|
std::to_string(cam.fps) +
|
||||||
" "
|
" "
|
||||||
"header-mode=each-idr "
|
"header-mode=each-idr "
|
||||||
|
|
||||||
"! h264parse config-interval=1 "
|
"! h264parse config-interval=1 "
|
||||||
|
|
||||||
// ⭐ 核心修复:统一 DTS / PTS
|
// ⭐⭐ 核心修复:时间戳整形(解决 DTS 回退 / WebRTC 抽风)
|
||||||
"! identity sync=true single-segment=true "
|
"! identity sync=true single-segment=true "
|
||||||
|
|
||||||
"! flvmux streamable=true "
|
"! flvmux streamable=true "
|
||||||
|
|
||||||
"! rtmpsink location=\"" +
|
"! rtmpsink location=\"" +
|
||||||
live_rtmp + "\" sync=false async=false";
|
live_rtmp +
|
||||||
|
"\" "
|
||||||
|
"sync=false async=false";
|
||||||
|
|
||||||
GError* error = nullptr;
|
GError* error = nullptr;
|
||||||
GstElement* pipeline = gst_parse_launch(pipeline_str.c_str(), &error);
|
GstElement* pipeline = gst_parse_launch(pipeline_str.c_str(), &error);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user