diff --git a/src/rtmp_manager.cpp b/src/rtmp_manager.cpp index 8c9bc01..568903d 100644 --- a/src/rtmp_manager.cpp +++ b/src/rtmp_manager.cpp @@ -52,11 +52,16 @@ std::string RTMPManager::make_key(const std::string& name) { return name + "_mai // ========== 创建 RTMP Pipeline ========== GstElement* RTMPManager::create_pipeline(const Camera& cam) { - const std::string rtmp_url = "rtmp://127.0.0.1:1935/" + cam.name; + const int fps = cam.fps > 0 ? cam.fps : 30; + const int bitrate = cam.bitrate > 0 ? cam.bitrate : 3500000; + + const std::string rtmp_url = "rtmp://127.0.0.1:1935/live/" + cam.name; std::string pipeline_str = "v4l2src name=src device=" + cam.device + " io-mode=dmabuf " - "! video/x-raw,format=NV12,width=1280,height=960,framerate=30/1 " + "! video/x-raw,format=NV12,width=1280,height=960,framerate=" + + std::to_string(fps) + + "/1 " "! videoscale method=nearest-neighbour " "! videocrop top=120 bottom=120 " "! video/x-raw,width=" + @@ -77,7 +82,7 @@ GstElement* RTMPManager::create_pipeline(const Camera& cam) std::to_string(fps) + " " "header-mode=each-idr profile=main " - "! h264parse config-interval=1 " + "! h264parse name=parse config-interval=1 " "! video/x-h264,stream-format=avc,alignment=au " "! flvmux streamable=true " "! rtmpsink location=\"" +