修改管线,去掉不支持的参数

This commit is contained in:
cxh 2026-01-20 14:17:53 +08:00
parent 389de678f9
commit 69f8196872

View File

@ -73,7 +73,7 @@ GstElement* RTMPManager::create_pipeline(const Camera& cam)
const std::string record_rtmp = "rtmp://127.0.0.1:2935/" + app + "/" + stream + "?vhost=record"; const std::string record_rtmp = "rtmp://127.0.0.1:2935/" + app + "/" + stream + "?vhost=record";
std::string pipeline_str = "v4l2src name=src device=" + cam.device + std::string pipeline_str = "v4l2src device=" + cam.device +
" io-mode=dmabuf " " io-mode=dmabuf "
"! video/x-raw,format=NV12,width=1920,height=1080,framerate=" + "! video/x-raw,format=NV12,width=1920,height=1080,framerate=" +
std::to_string(cam.fps) + std::to_string(cam.fps) +
@ -81,27 +81,28 @@ GstElement* RTMPManager::create_pipeline(const Camera& cam)
"! 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=2 leaky=downstream " " "
"! queue max-size-buffers=2 leaky=downstream "
"! mpph264enc rc-mode=cbr bps=" + "! mpph264enc rc-mode=cbr bps=" +
std::to_string(cam.bitrate) + " gop=" + std::to_string(cam.fps) + std::to_string(cam.bitrate) + " gop=" + std::to_string(cam.fps) +
" header-mode=each-idr profile=baseline " " header-mode=each-idr profile=baseline "
"! h264parse config-interval=1 " "! h264parse config-interval=1 "
"! tee name=t " "! tee name=t "
// ========= 录像(永远启用)============ // ===== record永远稳定 =====
"t. ! queue max-size-buffers=8 leaky=downstream " "t. ! queue max-size-buffers=8 leaky=downstream "
"! flvmux name=rec_mux streamable=true " "! flvmux name=rec_mux streamable=true "
"! rtmpsink name=rec_sink location=\"" + "! rtmpsink name=rec_sink location=\"" +
record_rtmp + record_rtmp +
"\" sync=false async=false drop-on-latency=true " "\" sync=false async=false "
// ========= livevalve 控制)=========== // ===== live可随意开关 =====
"t. ! queue max-size-buffers=8 leaky=downstream " "t. ! queue max-size-buffers=8 leaky=downstream "
"! valve name=live_valve drop=true " "! valve name=live_valve drop=true "
"! queue max-size-buffers=8 leaky=downstream " "! queue max-size-buffers=8 leaky=downstream "
"! flvmux name=live_mux streamable=true " "! flvmux name=live_mux streamable=true "
"! rtmpsink name=live_sink location=\"" + "! rtmpsink name=live_sink location=\"" +
live_rtmp + "\" sync=false async=false drop-on-latency=true "; live_rtmp + "\" sync=false async=false ";
GError* err = nullptr; GError* err = nullptr;
GstElement* pipeline = gst_parse_launch(pipeline_str.c_str(), &err); GstElement* pipeline = gst_parse_launch(pipeline_str.c_str(), &err);