aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--server/helpers/ffmpeg-utils.ts4
-rw-r--r--server/lib/video-transcoding-profiles.ts12
-rw-r--r--server/tests/plugins/plugin-transcoding.ts1
-rw-r--r--support/doc/plugins/guide.md9
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
396 396
397 if (options.resolution !== undefined) { 397 if (options.resolution !== undefined) {
398 scaleFilterValue = options.isPortraitMode === true 398 scaleFilterValue = options.isPortraitMode === true
399 ? `${options.resolution}:-2` 399 ? `w=${options.resolution}:h=-2`
400 : `-2:${options.resolution}` 400 : `w=-2:h=${options.resolution}`
401 } 401 }
402 402
403 command = await presetVideo({ command, input: options.inputPath, transcodeOptions: options, fps, scaleFilterValue }) 403 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'
24 24
25const defaultX264VODOptionsBuilder: EncoderOptionsBuilder = async ({ input, resolution, fps }) => { 25const defaultX264VODOptionsBuilder: EncoderOptionsBuilder = async ({ input, resolution, fps }) => {
26 const targetBitrate = await buildTargetBitrate({ input, resolution, fps }) 26 const targetBitrate = await buildTargetBitrate({ input, resolution, fps })
27 if (!targetBitrate) return { inputOptions: [ ], outputOptions: [ ] } 27 if (!targetBitrate) return { outputOptions: [ ] }
28 28
29 return { 29 return {
30 inputOptions: [ ],
31 outputOptions: [ 30 outputOptions: [
32 `-preset veryfast`, 31 `-preset veryfast`,
33 `-r ${fps}`, 32 `-r ${fps}`,
@@ -41,7 +40,6 @@ const defaultX264LiveOptionsBuilder: EncoderOptionsBuilder = async ({ resolution
41 const targetBitrate = getTargetBitrate(resolution, fps, VIDEO_TRANSCODING_FPS) 40 const targetBitrate = getTargetBitrate(resolution, fps, VIDEO_TRANSCODING_FPS)
42 41
43 return { 42 return {
44 inputOptions: [ ],
45 outputOptions: [ 43 outputOptions: [
46 `-preset veryfast`, 44 `-preset veryfast`,
47 `${buildStreamSuffix('-r:v', streamNum)} ${fps}`, 45 `${buildStreamSuffix('-r:v', streamNum)} ${fps}`,
@@ -57,7 +55,7 @@ const defaultAACOptionsBuilder: EncoderOptionsBuilder = async ({ input, streamNu
57 55
58 if (await canDoQuickAudioTranscode(input, probe)) { 56 if (await canDoQuickAudioTranscode(input, probe)) {
59 logger.debug('Copy audio stream %s by AAC encoder.', input) 57 logger.debug('Copy audio stream %s by AAC encoder.', input)
60 return { copy: true, inputOptions: [ ], outputOptions: [ ] } 58 return { copy: true, outputOptions: [ ] }
61 } 59 }
62 60
63 const parsedAudio = await getAudioStream(input, probe) 61 const parsedAudio = await getAudioStream(input, probe)
@@ -72,14 +70,14 @@ const defaultAACOptionsBuilder: EncoderOptionsBuilder = async ({ input, streamNu
72 logger.debug('Calculating audio bitrate of %s by AAC encoder.', input, { bitrate: parsedAudio.bitrate, audioCodecName }) 70 logger.debug('Calculating audio bitrate of %s by AAC encoder.', input, { bitrate: parsedAudio.bitrate, audioCodecName })
73 71
74 if (bitrate !== undefined && bitrate !== -1) { 72 if (bitrate !== undefined && bitrate !== -1) {
75 return { inputOptions: [ ], outputOptions: [ buildStreamSuffix('-b:a', streamNum), bitrate + 'k' ] } 73 return { outputOptions: [ buildStreamSuffix('-b:a', streamNum), bitrate + 'k' ] }
76 } 74 }
77 75
78 return { inputOptions: [ ], outputOptions: [ ] } 76 return { outputOptions: [ ] }
79} 77}
80 78
81const defaultLibFDKAACVODOptionsBuilder: EncoderOptionsBuilder = ({ streamNum }) => { 79const defaultLibFDKAACVODOptionsBuilder: EncoderOptionsBuilder = ({ streamNum }) => {
82 return { inputOptions: [ ], outputOptions: [ buildStreamSuffix('-q:a', streamNum), '5' ] } 80 return { outputOptions: [ buildStreamSuffix('-q:a', streamNum), '5' ] }
83} 81}
84 82
85// Used to get and update available encoders 83// 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 {
19 uninstallPlugin, 19 uninstallPlugin,
20 updateCustomSubConfig, 20 updateCustomSubConfig,
21 uploadVideoAndGetId, 21 uploadVideoAndGetId,
22 waitFfmpegUntilError,
23 waitJobs, 22 waitJobs,
24 waitUntilLivePublished 23 waitUntilLivePublished
25} from '../../../shared/extra-utils' 24} 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 ({
341 const streamString = streamNum ? ':' + streamNum : '' 341 const streamString = streamNum ? ':' + streamNum : ''
342 342
343 // You can also return a promise 343 // You can also return a promise
344 // All these options are optional and defaults to [] 344 // All these options are optional
345 return { 345 return {
346 scaleFilter: {
347 // Used to define an alternative scale filter, needed by some encoders
348 // Default to 'scale'
349 name: 'scale_vaapi'
350 },
351 // Default to []
346 inputOptions: [], 352 inputOptions: [],
353 // Default to []
347 outputOptions: [ 354 outputOptions: [
348 // Use a custom bitrate 355 // Use a custom bitrate
349 '-b' + streamString + ' 10K' 356 '-b' + streamString + ' 10K'