1
This commit is contained in:
parent
2357b35ba7
commit
b24a26e603
@ -77,53 +77,25 @@ GstElement* RTMPManager::create_pipeline(const Camera& cam)
|
|||||||
const std::string live_rtmp = "rtmp://36.153.162.171:19435/" + app + "/" + stream_name + "?vhost=live";
|
const std::string live_rtmp = "rtmp://36.153.162.171:19435/" + app + "/" + stream_name + "?vhost=live";
|
||||||
const std::string record_rtmp = "rtmp://127.0.0.1:2935/" + app + "/" + stream_name + "?vhost=record";
|
const std::string record_rtmp = "rtmp://127.0.0.1:2935/" + app + "/" + stream_name + "?vhost=record";
|
||||||
|
|
||||||
// 双路推流管线:一份流编码后 tee 分支分别送往两个 flvmux+rtmpsink
|
std::string cmd = "v4l2-ctl -d " + cam.device + " --set-fmt-video=width=" + std::to_string(width) +
|
||||||
// std::string pipeline_str =
|
",height=" + std::to_string(height) + ",pixelformat=NV12";
|
||||||
// "v4l2src name=src device=" + cam.device +
|
system(cmd.c_str());
|
||||||
// " ! "
|
|
||||||
// "video/x-raw,format=NV12,width=" +
|
|
||||||
// std::to_string(width) + ",height=" + std::to_string(height) + ",framerate=" + std::to_string(fps) +
|
|
||||||
// "/1 ! "
|
|
||||||
// "mpph264enc bps=" +
|
|
||||||
// std::to_string(bitrate) + " gop=" + std::to_string(fps) +
|
|
||||||
// " rc-mode=cbr ! "
|
|
||||||
// "h264parse ! tee name=t "
|
|
||||||
|
|
||||||
// // --- 分支1:低延时远控 SRS ---
|
|
||||||
// "t. ! queue max-size-buffers=5 leaky=downstream ! "
|
|
||||||
// "flvmux streamable=true name=mux_live "
|
|
||||||
// "audiotestsrc wave=silence ! audioconvert ! audioresample ! voaacenc ! aacparse ! mux_live. "
|
|
||||||
// "mux_live. ! rtmpsink location=\"" +
|
|
||||||
// live_rtmp +
|
|
||||||
// "\" sync=false async=false "
|
|
||||||
|
|
||||||
// // --- 分支2:录像 SRS ---
|
|
||||||
// "t. ! queue max-size-buffers=5 leaky=downstream ! "
|
|
||||||
// "flvmux streamable=true name=mux_record "
|
|
||||||
// "audiotestsrc wave=silence ! audioconvert ! audioresample ! voaacenc ! aacparse ! mux_record. "
|
|
||||||
// "mux_record. ! rtmpsink location=\"" +
|
|
||||||
// record_rtmp +
|
|
||||||
// "\" sync=false async=false "
|
|
||||||
|
|
||||||
// // --- 可选第三分支:AI/检测 ---
|
|
||||||
// "t. ! queue ! fakesink sync=false";
|
|
||||||
|
|
||||||
std::string pipeline_str = "v4l2src name=src device=" + cam.device +
|
std::string pipeline_str = "v4l2src name=src device=" + cam.device +
|
||||||
" ! video/x-raw,format=NV12 "
|
" io-mode=dmabuf "
|
||||||
" ! videoconvert "
|
" ! video/x-raw,format=NV12,"
|
||||||
" ! videoscale "
|
"width=" +
|
||||||
" ! video/x-raw,width=" +
|
|
||||||
std::to_string(width) + ",height=" + std::to_string(height) +
|
std::to_string(width) + ",height=" + std::to_string(height) +
|
||||||
",framerate=" + std::to_string(fps) +
|
",framerate=" + std::to_string(fps) +
|
||||||
"/1 "
|
"/1 "
|
||||||
" ! videoconvert "
|
|
||||||
" ! mpph264enc "
|
" ! mpph264enc "
|
||||||
|
"profile=high "
|
||||||
"bps=" +
|
"bps=" +
|
||||||
std::to_string(bitrate) + " gop=" + std::to_string(fps) +
|
std::to_string(bitrate) + " gop=" + std::to_string(fps) +
|
||||||
" rc-mode=cbr "
|
" rc-mode=cbr "
|
||||||
" header-mode=each-idr "
|
" header-mode=each-idr "
|
||||||
" ! h264parse config-interval=1 "
|
" ! h264parse config-interval=1 "
|
||||||
" ! queue max-size-buffers=5 leaky=downstream "
|
" ! queue max-size-buffers=5 max-size-time=0 leaky=downstream "
|
||||||
" ! flvmux streamable=true "
|
" ! flvmux streamable=true "
|
||||||
" ! rtmpsink location=\"" +
|
" ! rtmpsink location=\"" +
|
||||||
live_rtmp + "\" sync=false async=false";
|
live_rtmp + "\" sync=false async=false";
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user