|
|
|
|
@ -38,6 +38,16 @@ const details = (): IpluginDetails => ({
|
|
|
|
|
},
|
|
|
|
|
tooltip: 'Specify codec of the output file',
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
label: 'Enable FFmpeg Preset',
|
|
|
|
|
name: 'ffmpegPresetEnabled',
|
|
|
|
|
type: 'boolean',
|
|
|
|
|
defaultValue: 'true',
|
|
|
|
|
inputUI: {
|
|
|
|
|
type: 'switch',
|
|
|
|
|
},
|
|
|
|
|
tooltip: 'Specify whether to use an FFmpeg preset',
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
label: 'FFmpeg Preset',
|
|
|
|
|
name: 'ffmpegPreset',
|
|
|
|
|
@ -56,9 +66,34 @@ const details = (): IpluginDetails => ({
|
|
|
|
|
'superfast',
|
|
|
|
|
'ultrafast',
|
|
|
|
|
],
|
|
|
|
|
displayConditions: {
|
|
|
|
|
logic: 'AND',
|
|
|
|
|
sets: [
|
|
|
|
|
{
|
|
|
|
|
logic: 'AND',
|
|
|
|
|
inputs: [
|
|
|
|
|
{
|
|
|
|
|
name: 'ffmpegPresetEnabled',
|
|
|
|
|
value: 'true',
|
|
|
|
|
condition: '===',
|
|
|
|
|
},
|
|
|
|
|
],
|
|
|
|
|
},
|
|
|
|
|
],
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
tooltip: 'Specify ffmpeg preset',
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
label: 'Enable FFmpeg CRF',
|
|
|
|
|
name: 'ffmpegQualityEnabled',
|
|
|
|
|
type: 'boolean',
|
|
|
|
|
defaultValue: 'true',
|
|
|
|
|
inputUI: {
|
|
|
|
|
type: 'switch',
|
|
|
|
|
},
|
|
|
|
|
tooltip: 'Specify whether to set crf (or qp for GPU encoding)',
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
label: 'FFmpeg Quality',
|
|
|
|
|
name: 'ffmpegQuality',
|
|
|
|
|
@ -66,6 +101,21 @@ const details = (): IpluginDetails => ({
|
|
|
|
|
defaultValue: '25',
|
|
|
|
|
inputUI: {
|
|
|
|
|
type: 'text',
|
|
|
|
|
displayConditions: {
|
|
|
|
|
logic: 'AND',
|
|
|
|
|
sets: [
|
|
|
|
|
{
|
|
|
|
|
logic: 'AND',
|
|
|
|
|
inputs: [
|
|
|
|
|
{
|
|
|
|
|
name: 'ffmpegQualityEnabled',
|
|
|
|
|
value: 'true',
|
|
|
|
|
condition: '===',
|
|
|
|
|
},
|
|
|
|
|
],
|
|
|
|
|
},
|
|
|
|
|
],
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
tooltip: 'Specify ffmpeg quality',
|
|
|
|
|
},
|
|
|
|
|
@ -140,6 +190,7 @@ const plugin = async (args: IpluginInputArgs): Promise<IpluginOutputArgs> => {
|
|
|
|
|
|
|
|
|
|
if (stream.codec_type === 'video') {
|
|
|
|
|
const targetCodec = String(args.inputs.outputCodec);
|
|
|
|
|
const { ffmpegPresetEnabled, ffmpegQualityEnabled } = args.inputs;
|
|
|
|
|
const ffmpegPreset = String(args.inputs.ffmpegPreset);
|
|
|
|
|
const ffmpegQuality = String(args.inputs.ffmpegQuality);
|
|
|
|
|
const forceEncoding = args.inputs.forceEncoding === true;
|
|
|
|
|
@ -161,15 +212,19 @@ const plugin = async (args: IpluginInputArgs): Promise<IpluginOutputArgs> => {
|
|
|
|
|
|
|
|
|
|
stream.outputArgs.push('-c:{outputIndex}', encoderProperties.encoder);
|
|
|
|
|
|
|
|
|
|
if (ffmpegQualityEnabled) {
|
|
|
|
|
if (encoderProperties.isGpu) {
|
|
|
|
|
stream.outputArgs.push('-qp', ffmpegQuality);
|
|
|
|
|
} else {
|
|
|
|
|
stream.outputArgs.push('-crf', ffmpegQuality);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (ffmpegPresetEnabled) {
|
|
|
|
|
if (targetCodec !== 'av1' && ffmpegPreset) {
|
|
|
|
|
stream.outputArgs.push('-preset', ffmpegPreset);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (hardwareDecoding) {
|
|
|
|
|
stream.inputArgs.push(...encoderProperties.inputArgs);
|
|
|
|
|
|