增加码率自定义,config已更新
This commit is contained in:
parent
e524858cef
commit
d09f78a948
16
config.json
16
config.json
@ -14,7 +14,7 @@
|
|||||||
"device": "/dev/video11",
|
"device": "/dev/video11",
|
||||||
"name": "AHD1",
|
"name": "AHD1",
|
||||||
"enabled": true,
|
"enabled": true,
|
||||||
"resolution": "720p",
|
"bitrate": 2000000,
|
||||||
"width": 1280,
|
"width": 1280,
|
||||||
"height": 720,
|
"height": 720,
|
||||||
"fps": 30
|
"fps": 30
|
||||||
@ -23,7 +23,7 @@
|
|||||||
"device": "/dev/video12",
|
"device": "/dev/video12",
|
||||||
"name": "AHD2",
|
"name": "AHD2",
|
||||||
"enabled": false,
|
"enabled": false,
|
||||||
"resolution": "720p",
|
"bitrate": 2000000,
|
||||||
"width": 1280,
|
"width": 1280,
|
||||||
"height": 720,
|
"height": 720,
|
||||||
"fps": 30
|
"fps": 30
|
||||||
@ -32,7 +32,7 @@
|
|||||||
"device": "/dev/video13",
|
"device": "/dev/video13",
|
||||||
"name": "AHD3",
|
"name": "AHD3",
|
||||||
"enabled": false,
|
"enabled": false,
|
||||||
"resolution": "720p",
|
"bitrate": 2000000,
|
||||||
"width": 1280,
|
"width": 1280,
|
||||||
"height": 720,
|
"height": 720,
|
||||||
"fps": 30
|
"fps": 30
|
||||||
@ -41,7 +41,7 @@
|
|||||||
"device": "/dev/video14",
|
"device": "/dev/video14",
|
||||||
"name": "AHD4",
|
"name": "AHD4",
|
||||||
"enabled": false,
|
"enabled": false,
|
||||||
"resolution": "720p",
|
"bitrate": 2000000,
|
||||||
"width": 1280,
|
"width": 1280,
|
||||||
"height": 720,
|
"height": 720,
|
||||||
"fps": 30
|
"fps": 30
|
||||||
@ -50,7 +50,7 @@
|
|||||||
"device": "/dev/video3",
|
"device": "/dev/video3",
|
||||||
"name": "AHD5",
|
"name": "AHD5",
|
||||||
"enabled": false,
|
"enabled": false,
|
||||||
"resolution": "1080p",
|
"bitrate": 2000000,
|
||||||
"width": 1920,
|
"width": 1920,
|
||||||
"height": 1080,
|
"height": 1080,
|
||||||
"fps": 30
|
"fps": 30
|
||||||
@ -59,7 +59,7 @@
|
|||||||
"device": "/dev/video2",
|
"device": "/dev/video2",
|
||||||
"name": "AHD6",
|
"name": "AHD6",
|
||||||
"enabled": false,
|
"enabled": false,
|
||||||
"resolution": "1080p",
|
"bitrate": 2000000,
|
||||||
"width": 1920,
|
"width": 1920,
|
||||||
"height": 1080,
|
"height": 1080,
|
||||||
"fps": 30
|
"fps": 30
|
||||||
@ -68,7 +68,7 @@
|
|||||||
"device": "/dev/video1",
|
"device": "/dev/video1",
|
||||||
"name": "AHD7",
|
"name": "AHD7",
|
||||||
"enabled": false,
|
"enabled": false,
|
||||||
"resolution": "1080p",
|
"bitrate": 2000000,
|
||||||
"width": 1920,
|
"width": 1920,
|
||||||
"height": 1080,
|
"height": 1080,
|
||||||
"fps": 30
|
"fps": 30
|
||||||
@ -77,7 +77,7 @@
|
|||||||
"device": "/dev/video0",
|
"device": "/dev/video0",
|
||||||
"name": "AHD8",
|
"name": "AHD8",
|
||||||
"enabled": false,
|
"enabled": false,
|
||||||
"resolution": "1080p",
|
"bitrate": 2000000,
|
||||||
"width": 1920,
|
"width": 1920,
|
||||||
"height": 1080,
|
"height": 1080,
|
||||||
"fps": 30
|
"fps": 30
|
||||||
|
|||||||
@ -20,6 +20,7 @@ struct Camera
|
|||||||
std::string device;
|
std::string device;
|
||||||
std::string name;
|
std::string name;
|
||||||
int width, height, fps;
|
int width, height, fps;
|
||||||
|
int bitrate; // 新增码率字段 (bps)
|
||||||
bool enabled;
|
bool enabled;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -95,10 +96,12 @@ struct AppConfig
|
|||||||
cam.width = c.value("width", 1280);
|
cam.width = c.value("width", 1280);
|
||||||
cam.height = c.value("height", 720);
|
cam.height = c.value("height", 720);
|
||||||
cam.fps = c.value("fps", 30);
|
cam.fps = c.value("fps", 30);
|
||||||
|
cam.bitrate = c.value("bitrate", 2000000);
|
||||||
cam.enabled = c.value("enabled", false);
|
cam.enabled = c.value("enabled", false);
|
||||||
cfg.cameras.push_back(cam);
|
cfg.cameras.push_back(cam);
|
||||||
LOG_INFO("[Config] Loaded camera: " + cam.name +
|
LOG_INFO("[Config] Loaded camera: " + cam.name +
|
||||||
" (" + cam.device + "), enabled=" + std::to_string(cam.enabled));
|
" (" + cam.device + "), enabled=" + std::to_string(cam.enabled) +
|
||||||
|
", bitrate=" + std::to_string(cam.bitrate));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -36,8 +36,9 @@ GstRTSPMediaFactory *RTSPManager::create_media_factory(const Camera &cam)
|
|||||||
",height=" + std::to_string(out_height) +
|
",height=" + std::to_string(out_height) +
|
||||||
",framerate=" + std::to_string(cam.fps) + "/1"
|
",framerate=" + std::to_string(cam.fps) + "/1"
|
||||||
" ! queue max-size-buffers=1 leaky=downstream" // 最小队列
|
" ! queue max-size-buffers=1 leaky=downstream" // 最小队列
|
||||||
" ! mpph264enc bps=2000000 gop=" +
|
" ! mpph264enc bps=" +
|
||||||
std::to_string(cam.fps) + " " // 固定 4Mbps
|
std::to_string(cam.bitrate) +
|
||||||
|
" gop=" + std::to_string(cam.fps) + // GOP 设置为 1 秒
|
||||||
" ! h264parse"
|
" ! h264parse"
|
||||||
" ! rtph264pay name=pay0 pt=96 config-interval=1 )"; // 每秒发送 SPS/PPS
|
" ! rtph264pay name=pay0 pt=96 config-interval=1 )"; // 每秒发送 SPS/PPS
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user