Fix double -filter parameter when encoder sets filter
This commit is contained in:
parent
f54adc6b94
commit
05649aa2fd
@ -17,6 +17,7 @@ function createMapping(settings, stream, skills) {
|
||||
const mapping = {
|
||||
global: [],
|
||||
local: [],
|
||||
filter: [],
|
||||
};
|
||||
|
||||
return mapping;
|
||||
|
||||
@ -17,6 +17,7 @@ function createMapping(settings, stream, skills) {
|
||||
const mapping = {
|
||||
global: [],
|
||||
local: ['-hwaccel', 'cuda', '-c:v', 'av1_cuvid'],
|
||||
filter: [],
|
||||
};
|
||||
|
||||
return mapping;
|
||||
|
||||
@ -17,6 +17,7 @@ function createMapping(settings, stream, skills) {
|
||||
const mapping = {
|
||||
global: [],
|
||||
local: [],
|
||||
filter: [],
|
||||
};
|
||||
|
||||
return mapping;
|
||||
|
||||
@ -17,6 +17,7 @@ function createMapping(settings, stream, skills) {
|
||||
const mapping = {
|
||||
global: [],
|
||||
local: ['-c:v', 'h264_cuvid'],
|
||||
filter: [],
|
||||
};
|
||||
|
||||
return mapping;
|
||||
|
||||
@ -17,6 +17,7 @@ function createMapping(settings, stream, skills) {
|
||||
const mapping = {
|
||||
global: [],
|
||||
local: ['-c:v', 'h264_mmal'],
|
||||
filter: [],
|
||||
};
|
||||
|
||||
return mapping;
|
||||
|
||||
@ -17,6 +17,7 @@ function createMapping(settings, stream, skills) {
|
||||
const mapping = {
|
||||
global: [],
|
||||
local: ['-c:v', 'hevc_cuvid'],
|
||||
filter: [],
|
||||
};
|
||||
|
||||
return mapping;
|
||||
|
||||
@ -17,6 +17,7 @@ function createMapping(settings, stream, skills) {
|
||||
const mapping = {
|
||||
global: [],
|
||||
local: ['-c:v', 'mjpeg_cuvid'],
|
||||
filter: [],
|
||||
};
|
||||
|
||||
return mapping;
|
||||
|
||||
@ -17,6 +17,7 @@ function createMapping(settings, stream, skills) {
|
||||
const mapping = {
|
||||
global: [],
|
||||
local: ['-c:v', 'mpeg1_cuvid'],
|
||||
filter: [],
|
||||
};
|
||||
|
||||
return mapping;
|
||||
|
||||
@ -17,6 +17,7 @@ function createMapping(settings, stream, skills) {
|
||||
const mapping = {
|
||||
global: [],
|
||||
local: ['-c:v', 'mpeg2_cuvid'],
|
||||
filter: [],
|
||||
};
|
||||
|
||||
return mapping;
|
||||
|
||||
@ -17,6 +17,7 @@ function createMapping(settings, stream, skills) {
|
||||
const mapping = {
|
||||
global: [],
|
||||
local: ['-c:v', 'mpeg2_mmal'],
|
||||
filter: [],
|
||||
};
|
||||
|
||||
return mapping;
|
||||
|
||||
@ -17,6 +17,7 @@ function createMapping(settings, stream, skills) {
|
||||
const mapping = {
|
||||
global: [],
|
||||
local: ['-c:v', 'mpeg4_cuvid'],
|
||||
filter: [],
|
||||
};
|
||||
|
||||
return mapping;
|
||||
|
||||
@ -17,6 +17,7 @@ function createMapping(settings, stream, skills) {
|
||||
const mapping = {
|
||||
global: [],
|
||||
local: ['-c:v', 'mpeg4_mmal'],
|
||||
filter: [],
|
||||
};
|
||||
|
||||
return mapping;
|
||||
|
||||
@ -17,6 +17,7 @@ function createMapping(settings, stream, skills) {
|
||||
const mapping = {
|
||||
global: [],
|
||||
local: ['-hwaccel', 'cuda', '-hwaccel_output_format', 'cuda'],
|
||||
filter: [],
|
||||
};
|
||||
|
||||
return mapping;
|
||||
|
||||
@ -17,6 +17,7 @@ function createMapping(settings, stream, skills) {
|
||||
const mapping = {
|
||||
global: [],
|
||||
local: ['-c:v', 'vc1_cuvid'],
|
||||
filter: [],
|
||||
};
|
||||
|
||||
return mapping;
|
||||
|
||||
@ -17,6 +17,7 @@ function createMapping(settings, stream, skills) {
|
||||
const mapping = {
|
||||
global: [],
|
||||
local: ['-c:v', 'vc1_mmal'],
|
||||
filter: [],
|
||||
};
|
||||
|
||||
return mapping;
|
||||
|
||||
@ -17,6 +17,7 @@ function createMapping(settings, stream, skills) {
|
||||
const mapping = {
|
||||
global: [],
|
||||
local: ['-hwaccel', 'videotoolbox'],
|
||||
filter: [],
|
||||
};
|
||||
|
||||
return mapping;
|
||||
|
||||
@ -17,6 +17,7 @@ function createMapping(settings, stream, skills) {
|
||||
const mapping = {
|
||||
global: [],
|
||||
local: ['-c:v', 'vp8_cuvid'],
|
||||
filter: [],
|
||||
};
|
||||
|
||||
return mapping;
|
||||
|
||||
@ -17,6 +17,7 @@ function createMapping(settings, stream, skills) {
|
||||
const mapping = {
|
||||
global: [],
|
||||
local: ['-c:v', 'vp9_cuvid'],
|
||||
filter: [],
|
||||
};
|
||||
|
||||
return mapping;
|
||||
|
||||
@ -27,6 +27,7 @@ function createMapping(settings, stream, skills) {
|
||||
const mapping = {
|
||||
global: [],
|
||||
local: local,
|
||||
filter: [],
|
||||
};
|
||||
|
||||
return mapping;
|
||||
|
||||
@ -27,6 +27,7 @@ function createMapping(settings, stream, skills) {
|
||||
const mapping = {
|
||||
global: [['-vsync', 'drop']],
|
||||
local: local,
|
||||
filter: [],
|
||||
};
|
||||
|
||||
return mapping;
|
||||
|
||||
@ -15,6 +15,7 @@ function createMapping(settings, stream, skills) {
|
||||
const mapping = {
|
||||
global: [],
|
||||
local: local,
|
||||
filter: [],
|
||||
};
|
||||
|
||||
return mapping;
|
||||
|
||||
@ -24,6 +24,7 @@ function createMapping(settings, stream, skills) {
|
||||
const mapping = {
|
||||
global: [['-vsync', 'drop']],
|
||||
local: local,
|
||||
filter: [],
|
||||
};
|
||||
|
||||
return mapping;
|
||||
|
||||
@ -11,6 +11,7 @@ function createMapping(settings, stream, skills) {
|
||||
const mapping = {
|
||||
global: [],
|
||||
local: local,
|
||||
filter: [],
|
||||
};
|
||||
|
||||
return mapping;
|
||||
|
||||
@ -44,6 +44,7 @@ function createMapping(settings, stream, skills) {
|
||||
const mapping = {
|
||||
global: [['-vsync', 'drop']],
|
||||
local: local,
|
||||
filter: [],
|
||||
};
|
||||
|
||||
return mapping;
|
||||
|
||||
@ -23,6 +23,7 @@ function createMapping(settings, stream, skills) {
|
||||
const mapping = {
|
||||
global: [],
|
||||
local: local,
|
||||
filter: [],
|
||||
};
|
||||
|
||||
return mapping;
|
||||
|
||||
@ -23,6 +23,7 @@ function createMapping(settings, stream, skills) {
|
||||
const mapping = {
|
||||
global: [['-vsync', 'drop']],
|
||||
local: local,
|
||||
filter: [],
|
||||
};
|
||||
|
||||
return mapping;
|
||||
|
||||
@ -23,6 +23,7 @@ function createMapping(settings, stream, skills) {
|
||||
const mapping = {
|
||||
global: [['-vsync', 'drop']],
|
||||
local: local,
|
||||
filter: [],
|
||||
};
|
||||
|
||||
return mapping;
|
||||
|
||||
@ -78,6 +78,7 @@ function createMapping(settings, stream, skills) {
|
||||
const mapping = {
|
||||
global: [],
|
||||
local: local,
|
||||
filter: [],
|
||||
};
|
||||
|
||||
return mapping;
|
||||
|
||||
@ -11,6 +11,7 @@ function createMapping(settings, stream, skills) {
|
||||
const mapping = {
|
||||
global: [],
|
||||
local: local,
|
||||
filter: [],
|
||||
};
|
||||
|
||||
return mapping;
|
||||
|
||||
@ -71,6 +71,7 @@ function createMapping(settings, stream, skills) {
|
||||
const mapping = {
|
||||
global: [],
|
||||
local: local,
|
||||
filter: ['erosion'],
|
||||
};
|
||||
|
||||
return mapping;
|
||||
|
||||
@ -64,6 +64,7 @@ function createMapping(settings, stream, skills) {
|
||||
const mapping = {
|
||||
global: [],
|
||||
local: local,
|
||||
filter: [],
|
||||
};
|
||||
|
||||
return mapping;
|
||||
|
||||
@ -47,6 +47,7 @@ function createMapping(settings, stream, skills) {
|
||||
const mapping = {
|
||||
global: [],
|
||||
local: local,
|
||||
filter: [],
|
||||
};
|
||||
|
||||
return mapping;
|
||||
|
||||
@ -125,6 +125,7 @@ function createMapping(settings, stream, skills) {
|
||||
const mapping = {
|
||||
global: [],
|
||||
local: local,
|
||||
filter: [],
|
||||
};
|
||||
|
||||
return mapping;
|
||||
|
||||
@ -30,13 +30,12 @@ function createMapping(settings, stream, skills) {
|
||||
|
||||
const global = [];
|
||||
const local = [];
|
||||
const filter = [];
|
||||
|
||||
// https://trac.ffmpeg.org/wiki/Hardware/VAAPI
|
||||
global.push(['-vaapi_device', '/dev/dri/renderD128']);
|
||||
|
||||
local.push(
|
||||
'-vf',
|
||||
'format=nv12,hwupload',
|
||||
'-codec:v',
|
||||
'h264_vaapi',
|
||||
'-profile:v',
|
||||
@ -51,17 +50,18 @@ function createMapping(settings, stream, skills) {
|
||||
`${settings.bitrate}k`,
|
||||
'-r',
|
||||
`${settings.fps}`,
|
||||
'-g',
|
||||
`${settings.gop}`
|
||||
);
|
||||
|
||||
if (settings.gop !== 'auto') {
|
||||
local.push('-g', `${Math.round(parseInt(settings.fps) * parseInt(settings.gop)).toFixed(0)}`);
|
||||
}
|
||||
|
||||
filter.push('format=nv12', 'hwupload');
|
||||
|
||||
return {
|
||||
global: global,
|
||||
local: local,
|
||||
filter: filter,
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@ -58,6 +58,7 @@ function createMapping(settings, stream, skills) {
|
||||
const mapping = {
|
||||
global: [],
|
||||
local: local,
|
||||
filter: [],
|
||||
};
|
||||
|
||||
return mapping;
|
||||
|
||||
@ -71,6 +71,7 @@ function createMapping(settings, stream, skills) {
|
||||
const mapping = {
|
||||
global: [],
|
||||
local: local,
|
||||
filter: [],
|
||||
};
|
||||
|
||||
return mapping;
|
||||
|
||||
@ -30,13 +30,12 @@ function createMapping(settings, stream, skills) {
|
||||
|
||||
const global = [];
|
||||
const local = [];
|
||||
const filter = [];
|
||||
|
||||
// https://trac.ffmpeg.org/wiki/Hardware/VAAPI
|
||||
global.push(['-vaapi_device', '/dev/dri/renderD128']);
|
||||
|
||||
local.push(
|
||||
'-vf',
|
||||
'format=nv12,hwupload',
|
||||
'-codec:v',
|
||||
'hevc_vaapi',
|
||||
'-profile:v',
|
||||
@ -59,9 +58,12 @@ function createMapping(settings, stream, skills) {
|
||||
local.push('-g', `${Math.round(parseInt(settings.fps) * parseInt(settings.gop)).toFixed(0)}`);
|
||||
}
|
||||
|
||||
filter.push('format=nv12', 'hwupload');
|
||||
|
||||
return {
|
||||
global: global,
|
||||
local: local,
|
||||
filter: filter,
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@ -53,6 +53,7 @@ function createMapping(settings, stream, skills) {
|
||||
const mapping = {
|
||||
global: [],
|
||||
local: local,
|
||||
filter: [],
|
||||
};
|
||||
|
||||
return mapping;
|
||||
|
||||
@ -11,6 +11,7 @@ function createMapping(settings, stream, skills) {
|
||||
const mapping = {
|
||||
global: [],
|
||||
local: local,
|
||||
filter: [],
|
||||
};
|
||||
|
||||
return mapping;
|
||||
|
||||
@ -11,6 +11,7 @@ function createMapping(settings, stream, skills) {
|
||||
const mapping = {
|
||||
global: [],
|
||||
local: local,
|
||||
filter: [],
|
||||
};
|
||||
|
||||
return mapping;
|
||||
|
||||
@ -54,6 +54,7 @@ function createMapping(settings, stream, skills) {
|
||||
const mapping = {
|
||||
global: [],
|
||||
local: local,
|
||||
filter: [],
|
||||
};
|
||||
|
||||
return mapping;
|
||||
|
||||
@ -30,13 +30,12 @@ function createMapping(settings, stream, skills) {
|
||||
|
||||
const global = [];
|
||||
const local = [];
|
||||
const filter = [];
|
||||
|
||||
// https://trac.ffmpeg.org/wiki/Hardware/VAAPI
|
||||
global.push(['-vaapi_device', '/dev/dri/renderD128']);
|
||||
|
||||
local.push(
|
||||
'-vf',
|
||||
'format=nv12,hwupload',
|
||||
'-codec:v',
|
||||
'vp9_vaapi',
|
||||
'-profile:v',
|
||||
@ -52,16 +51,19 @@ function createMapping(settings, stream, skills) {
|
||||
'-r',
|
||||
`${settings.fps}`,
|
||||
'-g',
|
||||
`${settings.gop}`
|
||||
`${settings.gop}`,
|
||||
);
|
||||
|
||||
if (settings.gop !== 'auto') {
|
||||
local.push('-g', `${Math.round(parseInt(settings.fps) * parseInt(settings.gop)).toFixed(0)}`);
|
||||
}
|
||||
|
||||
filter.push('format=nv12', 'hwupload');
|
||||
|
||||
return {
|
||||
global: global,
|
||||
local: local,
|
||||
filter: filter,
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@ -662,14 +662,17 @@ const createInputsOutputs = (sources, profiles, requireVideo = true) => {
|
||||
|
||||
const local = profile.video.encoder.mapping.local.slice();
|
||||
|
||||
if (profile.video.encoder.coder !== 'copy' && profile.video.filter.graph.length !== 0) {
|
||||
// Check if there's already a video filter in the local mapping
|
||||
let filterIndex = local.indexOf('-filter:v');
|
||||
if (filterIndex !== -1) {
|
||||
local[filterIndex + 1] += ',' + profile.video.filter.graph;
|
||||
} else {
|
||||
local.unshift('-filter:v', profile.video.filter.graph);
|
||||
if (profile.video.encoder.coder !== 'copy' && (profile.video.filter.graph.length !== 0 || profile.video.encoder.mapping.filter.length !== 0)) {
|
||||
let filter = profile.video.filter.graph;
|
||||
if (profile.video.encoder.mapping.filter.length !== 0) {
|
||||
if (filter.length !== 0) {
|
||||
filter += ',';
|
||||
}
|
||||
|
||||
filter += profile.video.encoder.mapping.filter.join(',');
|
||||
}
|
||||
|
||||
local.unshift('-filter:v', filter);
|
||||
}
|
||||
|
||||
const options = ['-map', index + ':' + stream.stream, ...local];
|
||||
@ -696,14 +699,17 @@ const createInputsOutputs = (sources, profiles, requireVideo = true) => {
|
||||
|
||||
const local = profile.audio.encoder.mapping.local.slice();
|
||||
|
||||
if (profile.audio.encoder.coder !== 'copy' && profile.audio.filter.graph.length !== 0) {
|
||||
// Check if there's already a audio filter in the local mapping
|
||||
let filterIndex = local.indexOf('-filter:a');
|
||||
if (filterIndex !== -1) {
|
||||
local[filterIndex + 1] += ',' + profile.audio.filter.graph;
|
||||
} else {
|
||||
local.unshift('-filter:a', profile.audio.filter.graph);
|
||||
if (profile.audio.encoder.coder !== 'copy' && (profile.audio.filter.graph.length !== 0 || profile.audio.encoder.mapping.filter.length !== 0)) {
|
||||
let filter = profile.audio.filter.graph;
|
||||
if (profile.audio.encoder.mapping.filter.length !== 0) {
|
||||
if (filter.length !== 0) {
|
||||
filter += ',';
|
||||
}
|
||||
|
||||
filter += profile.audio.encoder.mapping.filter.join(',');
|
||||
}
|
||||
|
||||
local.unshift('-filter:a', filter);
|
||||
}
|
||||
|
||||
options.push('-map', index + ':' + stream.stream, ...local);
|
||||
@ -844,11 +850,13 @@ const initProfile = (initialProfile) => {
|
||||
profile.video.encoder.mapping = {
|
||||
global: [],
|
||||
local: profile.video.encoder.mapping,
|
||||
filter: [],
|
||||
};
|
||||
} else {
|
||||
profile.video.encoder.mapping = {
|
||||
global: [],
|
||||
local: [],
|
||||
filter: [],
|
||||
...profile.video.encoder.mapping,
|
||||
};
|
||||
}
|
||||
@ -864,11 +872,13 @@ const initProfile = (initialProfile) => {
|
||||
profile.video.decoder.mapping = {
|
||||
global: [],
|
||||
local: profile.video.decoder.mapping,
|
||||
filter: [],
|
||||
};
|
||||
} else {
|
||||
profile.video.decoder.mapping = {
|
||||
global: [],
|
||||
local: [],
|
||||
filter: [],
|
||||
...profile.video.decoder.mapping,
|
||||
};
|
||||
}
|
||||
@ -899,11 +909,13 @@ const initProfile = (initialProfile) => {
|
||||
profile.audio.encoder.mapping = {
|
||||
global: [],
|
||||
local: profile.audio.encoder.mapping,
|
||||
filter: [],
|
||||
};
|
||||
} else {
|
||||
profile.audio.encoder.mapping = {
|
||||
global: [],
|
||||
local: [],
|
||||
filter: [],
|
||||
...profile.audio.encoder.mapping,
|
||||
};
|
||||
}
|
||||
@ -919,11 +931,13 @@ const initProfile = (initialProfile) => {
|
||||
profile.audio.decoder.mapping = {
|
||||
global: [],
|
||||
local: profile.audio.decoder.mapping,
|
||||
filter: [],
|
||||
};
|
||||
} else {
|
||||
profile.audio.decoder.mapping = {
|
||||
global: [],
|
||||
local: [],
|
||||
filter: [],
|
||||
...profile.audio.decoder.mapping,
|
||||
};
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user