1
0
mirror of https://codeberg.org/polarisfm/youtube-dl synced 2024-12-01 20:57:54 +01:00

Handle Opus bitrate when quality is specified instead of bitrate

This commit is contained in:
Hattshire 2019-02-26 16:31:00 -03:00
parent 55b8588f0e
commit c3029c4468

View File

@ -307,6 +307,26 @@ class FFmpegExtractAudioPP(FFmpegPostProcessor):
# The opus codec doesn't support the -aq option
if int(self._preferredquality) < 10 and extension != 'opus':
more_opts += ['-q:a', self._preferredquality]
else if int(self._preferredquality) < 10:
# Handle opus quality/bitrate using Xiph.org's Recommended Settings
if int(self._preferredquality) == 9:
more_opts += ['-b:a', '450k']
else if int(self._preferredquality) == 8:
more_opts += ['-b:a', '256k']
else if int(self._preferredquality) == 7:
more_opts += ['-b:a', '128k']
else if int(self._preferredquality) == 6:
more_opts += ['-b:a', '96k']
else if int(self._preferredquality) == 5:
more_opts += ['-b:a', '64k']
else if int(self._preferredquality) == 4:
more_opts += ['-b:a', '32k']
else if int(self._preferredquality) == 3:
more_opts += ['-b:a', '24k']
else if int(self._preferredquality) == 2:
more_opts += ['-b:a', '10k']
else:
more_opts += ['-b:a', '6k']
else:
more_opts += ['-b:a', self._preferredquality + 'k']
if self._preferredcodec == 'aac':