aboutsummaryrefslogtreecommitdiffhomepage
path: root/server
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2021-04-09 15:31:09 +0200
committerChocobozzz <chocobozzz@cpy.re>2021-04-09 15:53:18 +0200
commita60696ab185406700a5277edae54016b0add7b89 (patch)
tree5a2b4a813af3afe02251551147033f9f903dbb34 /server
parent3e03b961b8ab897500dfea626f808c009f64e551 (diff)
downloadPeerTube-a60696ab185406700a5277edae54016b0add7b89.tar.gz
PeerTube-a60696ab185406700a5277edae54016b0add7b89.tar.zst
PeerTube-a60696ab185406700a5277edae54016b0add7b89.zip
Add scale filter to documentation
Diffstat (limited to 'server')
-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
3 files changed, 7 insertions, 10 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'