aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/lib
diff options
context:
space:
mode:
authorThéo Le Calvar <tlc@kher.nl>2021-04-03 18:48:14 +0200
committerChocobozzz <chocobozzz@cpy.re>2021-04-09 15:53:18 +0200
commit5fb7cfbac50e2c55f04182e40bc6f84e5dd4a4da (patch)
tree8a253611577988fb71527477ae138be7eaf49c6b /server/lib
parentd2466f0ac9c9877df10f62b7ac20bc3253a2a84a (diff)
downloadPeerTube-5fb7cfbac50e2c55f04182e40bc6f84e5dd4a4da.tar.gz
PeerTube-5fb7cfbac50e2c55f04182e40bc6f84e5dd4a4da.tar.zst
PeerTube-5fb7cfbac50e2c55f04182e40bc6f84e5dd4a4da.zip
add support for inputOptions in trancode plugins
Diffstat (limited to 'server/lib')
-rw-r--r--server/lib/video-transcoding-profiles.ts12
1 files changed, 7 insertions, 5 deletions
diff --git a/server/lib/video-transcoding-profiles.ts b/server/lib/video-transcoding-profiles.ts
index b7f9178c4..d802e2c9d 100644
--- a/server/lib/video-transcoding-profiles.ts
+++ b/server/lib/video-transcoding-profiles.ts
@@ -24,9 +24,10 @@ 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 { outputOptions: [ ] } 27 if (!targetBitrate) return { inputOptions: [ ], outputOptions: [ ] }
28 28
29 return { 29 return {
30 inputOptions: [ ],
30 outputOptions: [ 31 outputOptions: [
31 `-preset veryfast`, 32 `-preset veryfast`,
32 `-r ${fps}`, 33 `-r ${fps}`,
@@ -40,6 +41,7 @@ const defaultX264LiveOptionsBuilder: EncoderOptionsBuilder = async ({ resolution
40 const targetBitrate = getTargetBitrate(resolution, fps, VIDEO_TRANSCODING_FPS) 41 const targetBitrate = getTargetBitrate(resolution, fps, VIDEO_TRANSCODING_FPS)
41 42
42 return { 43 return {
44 inputOptions: [ ],
43 outputOptions: [ 45 outputOptions: [
44 `-preset veryfast`, 46 `-preset veryfast`,
45 `${buildStreamSuffix('-r:v', streamNum)} ${fps}`, 47 `${buildStreamSuffix('-r:v', streamNum)} ${fps}`,
@@ -55,7 +57,7 @@ const defaultAACOptionsBuilder: EncoderOptionsBuilder = async ({ input, streamNu
55 57
56 if (await canDoQuickAudioTranscode(input, probe)) { 58 if (await canDoQuickAudioTranscode(input, probe)) {
57 logger.debug('Copy audio stream %s by AAC encoder.', input) 59 logger.debug('Copy audio stream %s by AAC encoder.', input)
58 return { copy: true, outputOptions: [] } 60 return { copy: true, inputOptions: [ ], outputOptions: [ ] }
59 } 61 }
60 62
61 const parsedAudio = await getAudioStream(input, probe) 63 const parsedAudio = await getAudioStream(input, probe)
@@ -70,14 +72,14 @@ const defaultAACOptionsBuilder: EncoderOptionsBuilder = async ({ input, streamNu
70 logger.debug('Calculating audio bitrate of %s by AAC encoder.', input, { bitrate: parsedAudio.bitrate, audioCodecName }) 72 logger.debug('Calculating audio bitrate of %s by AAC encoder.', input, { bitrate: parsedAudio.bitrate, audioCodecName })
71 73
72 if (bitrate !== undefined && bitrate !== -1) { 74 if (bitrate !== undefined && bitrate !== -1) {
73 return { outputOptions: [ buildStreamSuffix('-b:a', streamNum), bitrate + 'k' ] } 75 return { inputOptions: [ ], outputOptions: [ buildStreamSuffix('-b:a', streamNum), bitrate + 'k' ] }
74 } 76 }
75 77
76 return { outputOptions: [ ] } 78 return { inputOptions: [ ], outputOptions: [ ] }
77} 79}
78 80
79const defaultLibFDKAACVODOptionsBuilder: EncoderOptionsBuilder = ({ streamNum }) => { 81const defaultLibFDKAACVODOptionsBuilder: EncoderOptionsBuilder = ({ streamNum }) => {
80 return { outputOptions: [ buildStreamSuffix('-q:a', streamNum), '5' ] } 82 return { inputOptions: [ ], outputOptions: [ buildStreamSuffix('-q:a', streamNum), '5' ] }
81} 83}
82 84
83// Used to get and update available encoders 85// Used to get and update available encoders