优化管线
This commit is contained in:
parent
0281aeafdd
commit
9dde95485e
@ -1,4 +1,4 @@
|
|||||||
// rtsp_manager.cpp
|
// rtmp_manager.cpp
|
||||||
#include "rtmp_manager.hpp"
|
#include "rtmp_manager.hpp"
|
||||||
|
|
||||||
#include <arpa/inet.h>
|
#include <arpa/inet.h>
|
||||||
@ -74,24 +74,22 @@ GstElement *RTMPManager::create_pipeline(const Camera &cam)
|
|||||||
const std::string app = "camera";
|
const std::string app = "camera";
|
||||||
const std::string location = "rtmp://127.0.0.1:1935/" + app + "/" + stream_name + "?vhost=live";
|
const std::string location = "rtmp://127.0.0.1:1935/" + app + "/" + stream_name + "?vhost=live";
|
||||||
|
|
||||||
// 给关键元素起名字:src, vc, enc, par, mux, sink, tee
|
|
||||||
std::string pipeline_str = "v4l2src name=src device=" + cam.device +
|
std::string pipeline_str = "v4l2src name=src device=" + cam.device +
|
||||||
" ! video/x-raw,width=" + std::to_string(width) + ",height=" + std::to_string(height) +
|
" ! "
|
||||||
|
"video/x-raw,format=NV12,width=" +
|
||||||
|
std::to_string(width) + ",height=" + std::to_string(height) +
|
||||||
",framerate=" + std::to_string(fps) +
|
",framerate=" + std::to_string(fps) +
|
||||||
"/1 "
|
"/1 ! "
|
||||||
"! videoconvert name=vc ! video/x-raw,format=NV12 "
|
"tee name=t "
|
||||||
"! tee name=t "
|
"t. ! queue max-size-buffers=5 leaky=downstream ! "
|
||||||
"t. ! queue "
|
"mpph264enc bps=" +
|
||||||
"! mpph264enc name=enc bps=" +
|
|
||||||
std::to_string(bitrate) + " gop=" + std::to_string(fps) +
|
std::to_string(bitrate) + " gop=" + std::to_string(fps) +
|
||||||
" "
|
" rc-mode=cbr ! "
|
||||||
"! h264parse name=par "
|
"h264parse ! flvmux streamable=true name=mux "
|
||||||
"! flvmux name=mux streamable=true "
|
|
||||||
"audiotestsrc wave=silence ! audioconvert ! audioresample ! voaacenc ! aacparse ! mux. "
|
"audiotestsrc wave=silence ! audioconvert ! audioresample ! voaacenc ! aacparse ! mux. "
|
||||||
"mux. ! rtmpsink name=sink location=\"" +
|
"mux. ! rtmpsink location=\"" +
|
||||||
location +
|
location +
|
||||||
"\" sync=false "
|
"\" sync=false async=false "
|
||||||
// 预留第二路 tee 分支(以后加叠加/探测都行),先丢掉
|
|
||||||
"t. ! queue ! fakesink sync=false";
|
"t. ! queue ! fakesink sync=false";
|
||||||
|
|
||||||
GError* error = nullptr;
|
GError* error = nullptr;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user