NodeMediaServer MP4更改默认视频分辨率540p



我已经设置了一个nginx RTMP服务器,目的是存储视频流从移动设备在MP4格式供以后分析。尽管移动设备以720p分辨率流式传输视频,但NodeMediaServer始终以540p分辨率存储视频。我怎样才能改变这种行为?以下是NodeMediaServer配置:

const nodeMediaServerConfig = {
rtmp: {
port: 1936,
chunk_size: 60000,
gop_cache: true,
ping: 60,
ping_timeout: 10,
},
http: {
port: 8000,
mediaroot: './media',
allow_origin: '*',
},
trans: {
ffmpeg: '/usr/bin/ffmpeg',
tasks: [
{
app: 'live',
vcParam: [
"-c:v",
"libx264",
"-vf",
"scale=720:-1",
"-b:v",
"2800k",
"-bufsize",
"4200k",
"-preset",
"fast",
],
ac: 'aac',
acParam:["-b:a", "128k", "-ar", 48000],
mp4: true,
mp4Flags: '[movflags=faststart]',
},
],
},
};

在这件事上任何帮助都是非常感谢的。

scale=720:-1改为scale=-2:720

如果您使用scale=720:-1与输入1920x1080,它将缩放到720x405。如果您使用scale=-2:720的输入为1920x1080,它将被缩放到1280x720。

  • 第一个值是width
  • 第二个值是高度
  • -2将自动计算适当的值来保留aspect(相对于其他值),并将调整值使其可被2整除(libx264需要)。

参见刻度过滤器文档。

最新更新