From a60696ab185406700a5277edae54016b0add7b89 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Fri, 9 Apr 2021 15:31:09 +0200 Subject: [PATCH] Add scale filter to documentation --- server/helpers/ffmpeg-utils.ts | 4 ++-- server/lib/video-transcoding-profiles.ts | 12 +++++------- server/tests/plugins/plugin-transcoding.ts | 1 - support/doc/plugins/guide.md | 9 ++++++++- 4 files changed, 15 insertions(+), 11 deletions(-) diff --git a/server/helpers/ffmpeg-utils.ts b/server/helpers/ffmpeg-utils.ts index aa4223cda..75297df8f 100644 --- a/server/helpers/ffmpeg-utils.ts +++ b/server/helpers/ffmpeg-utils.ts @@ -396,8 +396,8 @@ async function buildx264VODCommand (command: ffmpeg.FfmpegCommand, options: Tran if (options.resolution !== undefined) { scaleFilterValue = options.isPortraitMode === true - ? `${options.resolution}:-2` - : `-2:${options.resolution}` + ? `w=${options.resolution}:h=-2` + : `w=-2:h=${options.resolution}` } command = await presetVideo({ command, input: options.inputPath, transcodeOptions: options, fps, scaleFilterValue }) diff --git a/server/lib/video-transcoding-profiles.ts b/server/lib/video-transcoding-profiles.ts index d802e2c9d..81f5e1962 100644 --- a/server/lib/video-transcoding-profiles.ts +++ b/server/lib/video-transcoding-profiles.ts @@ -24,10 +24,9 @@ import { VIDEO_TRANSCODING_FPS } from '../initializers/constants' const defaultX264VODOptionsBuilder: EncoderOptionsBuilder = async ({ input, resolution, fps }) => { const targetBitrate = await buildTargetBitrate({ input, resolution, fps }) - if (!targetBitrate) return { inputOptions: [ ], outputOptions: [ ] } + if (!targetBitrate) return { outputOptions: [ ] } return { - inputOptions: [ ], outputOptions: [ `-preset veryfast`, `-r ${fps}`, @@ -41,7 +40,6 @@ const defaultX264LiveOptionsBuilder: EncoderOptionsBuilder = async ({ resolution const targetBitrate = getTargetBitrate(resolution, fps, VIDEO_TRANSCODING_FPS) return { - inputOptions: [ ], outputOptions: [ `-preset veryfast`, `${buildStreamSuffix('-r:v', streamNum)} ${fps}`, @@ -57,7 +55,7 @@ const defaultAACOptionsBuilder: EncoderOptionsBuilder = async ({ input, streamNu if (await canDoQuickAudioTranscode(input, probe)) { logger.debug('Copy audio stream %s by AAC encoder.', input) - return { copy: true, inputOptions: [ ], outputOptions: [ ] } + return { copy: true, outputOptions: [ ] } } const parsedAudio = await getAudioStream(input, probe) @@ -72,14 +70,14 @@ const defaultAACOptionsBuilder: EncoderOptionsBuilder = async ({ input, streamNu logger.debug('Calculating audio bitrate of %s by AAC encoder.', input, { bitrate: parsedAudio.bitrate, audioCodecName }) if (bitrate !== undefined && bitrate !== -1) { - return { inputOptions: [ ], outputOptions: [ buildStreamSuffix('-b:a', streamNum), bitrate + 'k' ] } + return { outputOptions: [ buildStreamSuffix('-b:a', streamNum), bitrate + 'k' ] } } - return { inputOptions: [ ], outputOptions: [ ] } + return { outputOptions: [ ] } } const defaultLibFDKAACVODOptionsBuilder: EncoderOptionsBuilder = ({ streamNum }) => { - return { inputOptions: [ ], outputOptions: [ buildStreamSuffix('-q:a', streamNum), '5' ] } + return { outputOptions: [ buildStreamSuffix('-q:a', streamNum), '5' ] } } // Used to get and update available encoders diff --git a/server/tests/plugins/plugin-transcoding.ts b/server/tests/plugins/plugin-transcoding.ts index b6dff930e..c834b6985 100644 --- a/server/tests/plugins/plugin-transcoding.ts +++ b/server/tests/plugins/plugin-transcoding.ts @@ -19,7 +19,6 @@ import { uninstallPlugin, updateCustomSubConfig, uploadVideoAndGetId, - waitFfmpegUntilError, waitJobs, waitUntilLivePublished } from '../../../shared/extra-utils' diff --git a/support/doc/plugins/guide.md b/support/doc/plugins/guide.md index ea33b8d9f..e30d95fc9 100644 --- a/support/doc/plugins/guide.md +++ b/support/doc/plugins/guide.md @@ -341,9 +341,16 @@ async function register ({ const streamString = streamNum ? ':' + streamNum : '' // You can also return a promise - // All these options are optional and defaults to [] + // All these options are optional return { + scaleFilter: { + // Used to define an alternative scale filter, needed by some encoders + // Default to 'scale' + name: 'scale_vaapi' + }, + // Default to [] inputOptions: [], + // Default to [] outputOptions: [ // Use a custom bitrate '-b' + streamString + ' 10K'