mirror of https://github.com/Chocobozzz/PeerTube
Don't set a bitrate on unknown audio input
parent
e63dbd426e
commit
eed24d26db
|
@ -236,7 +236,7 @@ namespace audio {
|
|||
}
|
||||
|
||||
export namespace bitrate {
|
||||
export const baseKbitrate = 384
|
||||
const baseKbitrate = 384
|
||||
|
||||
const toBits = (kbits: number): number => { return kbits * 8000 }
|
||||
|
||||
|
@ -274,7 +274,6 @@ namespace audio {
|
|||
* See https://trac.ffmpeg.org/wiki/Encode/AAC#fdk_vbr
|
||||
*/
|
||||
async function standard (_ffmpeg) {
|
||||
let _bitrate = audio.bitrate.baseKbitrate
|
||||
let localFfmpeg = _ffmpeg
|
||||
.format('mp4')
|
||||
.videoCodec('libx264')
|
||||
|
@ -289,15 +288,6 @@ async function standard (_ffmpeg) {
|
|||
return localFfmpeg.noAudio()
|
||||
}
|
||||
|
||||
// we try to reduce the ceiling bitrate by making rough correspondances of bitrates
|
||||
// of course this is far from perfect, but it might save some space in the end
|
||||
if (audio.bitrate[_audio.audioStream['codec_name']]) {
|
||||
_bitrate = audio.bitrate[_audio.audioStream['codec_name']](_audio.audioStream['bit_rate'])
|
||||
if (_bitrate === -1) {
|
||||
return localFfmpeg.audioCodec('copy')
|
||||
}
|
||||
}
|
||||
|
||||
// we favor VBR, if a good AAC encoder is available
|
||||
if ((await checkFFmpegEncoders()).get('libfdk_aac')) {
|
||||
return localFfmpeg
|
||||
|
@ -305,5 +295,17 @@ async function standard (_ffmpeg) {
|
|||
.audioQuality(5)
|
||||
}
|
||||
|
||||
return localFfmpeg.audioBitrate(_bitrate)
|
||||
// we try to reduce the ceiling bitrate by making rough correspondances of bitrates
|
||||
// of course this is far from perfect, but it might save some space in the end
|
||||
const audioCodecName = _audio.audioStream['codec_name']
|
||||
let bitrate: number
|
||||
if (audio.bitrate[audioCodecName]) {
|
||||
bitrate = audio.bitrate[audioCodecName](_audio.audioStream['bit_rate'])
|
||||
|
||||
if (bitrate === -1) return localFfmpeg.audioCodec('copy')
|
||||
}
|
||||
|
||||
if (bitrate !== undefined) return localFfmpeg.audioBitrate(bitrate)
|
||||
|
||||
return localFfmpeg
|
||||
}
|
||||
|
|
|
@ -209,19 +209,19 @@ describe('Test multiple servers', function () {
|
|||
files: [
|
||||
{
|
||||
resolution: 240,
|
||||
size: 342000
|
||||
size: 187000
|
||||
},
|
||||
{
|
||||
resolution: 360,
|
||||
size: 433000
|
||||
size: 278000
|
||||
},
|
||||
{
|
||||
resolution: 480,
|
||||
size: 538000
|
||||
size: 383000
|
||||
},
|
||||
{
|
||||
resolution: 720,
|
||||
size: 861000
|
||||
size: 706000
|
||||
}
|
||||
],
|
||||
thumbnailfile: 'thumbnail',
|
||||
|
|
Loading…
Reference in New Issue