test
This commit is contained in:
parent
9d39aa14d3
commit
2a49aef598
3
.vscode/settings.json
vendored
3
.vscode/settings.json
vendored
@ -63,6 +63,7 @@
|
||||
"typeindex": "cpp",
|
||||
"typeinfo": "cpp",
|
||||
"valarray": "cpp",
|
||||
"variant": "cpp"
|
||||
"variant": "cpp",
|
||||
"set": "cpp"
|
||||
}
|
||||
}
|
||||
@ -25,15 +25,29 @@ void RTSPManager::init()
|
||||
// 创建 media factory
|
||||
GstRTSPMediaFactory *RTSPManager::create_media_factory(const Camera &cam)
|
||||
{
|
||||
int out_width = cam.width;
|
||||
int out_height = cam.height;
|
||||
|
||||
// 如果是 1280x960,则裁剪到 1280x720
|
||||
std::string videocrop_str;
|
||||
if (cam.width == 1280 && cam.height == 960)
|
||||
{
|
||||
out_height = 720;
|
||||
// 使用 videocrop 元素从顶部裁剪 120 像素,总共裁剪 960->720
|
||||
int crop_top = (960 - 720) / 2;
|
||||
videocrop_str = " ! videocrop top=" + std::to_string(crop_top) + " bottom=" + std::to_string(crop_top);
|
||||
}
|
||||
|
||||
std::string launch_str =
|
||||
"( v4l2src device=" + cam.device +
|
||||
" ! video/x-raw,format=NV12,width=" + std::to_string(cam.width) +
|
||||
",height=" + std::to_string(cam.height) +
|
||||
",framerate=" + std::to_string(cam.fps) + "/1"
|
||||
" ! queue max-size-buffers=4 leaky=2" // 新增 queue,防止阻塞
|
||||
" ! queue max-size-buffers=4 leaky=2"
|
||||
" ! videoconvert"
|
||||
" ! video/x-raw,format=NV12" // 固定转换后的格式
|
||||
" ! queue max-size-buffers=4 leaky=2" // 再加一层 queue,隔离 mpph264enc
|
||||
" ! video/x-raw,format=NV12" +
|
||||
videocrop_str +
|
||||
" ! queue max-size-buffers=4 leaky=2"
|
||||
" ! mpph264enc"
|
||||
" ! rtph264pay name=pay0 pt=96 )";
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user