mirror of
https://github.com/Chocobozzz/PeerTube.git
synced 2025-10-06 03:50:26 +02:00
add support for inputOptions in trancode plugins
This commit is contained in:
parent
d2466f0ac9
commit
5fb7cfbac5
4 changed files with 13 additions and 5 deletions
|
@ -24,9 +24,10 @@ import { VIDEO_TRANSCODING_FPS } from '../initializers/constants'
|
|||
|
||||
const defaultX264VODOptionsBuilder: EncoderOptionsBuilder = async ({ input, resolution, fps }) => {
|
||||
const targetBitrate = await buildTargetBitrate({ input, resolution, fps })
|
||||
if (!targetBitrate) return { outputOptions: [ ] }
|
||||
if (!targetBitrate) return { inputOptions: [ ], outputOptions: [ ] }
|
||||
|
||||
return {
|
||||
inputOptions: [ ],
|
||||
outputOptions: [
|
||||
`-preset veryfast`,
|
||||
`-r ${fps}`,
|
||||
|
@ -40,6 +41,7 @@ const defaultX264LiveOptionsBuilder: EncoderOptionsBuilder = async ({ resolution
|
|||
const targetBitrate = getTargetBitrate(resolution, fps, VIDEO_TRANSCODING_FPS)
|
||||
|
||||
return {
|
||||
inputOptions: [ ],
|
||||
outputOptions: [
|
||||
`-preset veryfast`,
|
||||
`${buildStreamSuffix('-r:v', streamNum)} ${fps}`,
|
||||
|
@ -55,7 +57,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, outputOptions: [] }
|
||||
return { copy: true, inputOptions: [ ], outputOptions: [ ] }
|
||||
}
|
||||
|
||||
const parsedAudio = await getAudioStream(input, probe)
|
||||
|
@ -70,14 +72,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 { outputOptions: [ buildStreamSuffix('-b:a', streamNum), bitrate + 'k' ] }
|
||||
return { inputOptions: [ ], outputOptions: [ buildStreamSuffix('-b:a', streamNum), bitrate + 'k' ] }
|
||||
}
|
||||
|
||||
return { outputOptions: [ ] }
|
||||
return { inputOptions: [ ], outputOptions: [ ] }
|
||||
}
|
||||
|
||||
const defaultLibFDKAACVODOptionsBuilder: EncoderOptionsBuilder = ({ streamNum }) => {
|
||||
return { outputOptions: [ buildStreamSuffix('-q:a', streamNum), '5' ] }
|
||||
return { inputOptions: [ ], outputOptions: [ buildStreamSuffix('-q:a', streamNum), '5' ] }
|
||||
}
|
||||
|
||||
// Used to get and update available encoders
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue