mirror of
https://github.com/ytdl-org/youtube-dl
synced 2024-12-22 20:20:09 +09:00
Merge 5831f6feef
into d55d1f423d
This commit is contained in:
commit
11931a78ba
@ -22,6 +22,7 @@ from ..utils import (
|
||||
dfxp2srt,
|
||||
ISO639Utils,
|
||||
replace_extension,
|
||||
compat_str,
|
||||
)
|
||||
|
||||
|
||||
@ -300,8 +301,15 @@ class FFmpegExtractAudioPP(FFmpegPostProcessor):
|
||||
extension = self._preferredcodec
|
||||
more_opts = []
|
||||
if self._preferredquality is not None:
|
||||
# The opus codec doesn't support the -aq option
|
||||
if int(self._preferredquality) < 10 and extension != 'opus':
|
||||
if int(self._preferredquality) < 10:
|
||||
if extension == 'opus':
|
||||
# The opus codec doesn't support the -q:a option
|
||||
# Magic number of 24 used to give quality numbers 0-9 *some* meaning (as suggested by "knarrff" on Github)
|
||||
# 0 (best quality) gives 210 kb/s
|
||||
# 5 (default) gives 96 kb/s
|
||||
# 9 (worst quality) gives 6 kb/s, which is the opus minimum (and 0 kb/s wouldn't make any sense)
|
||||
more_opts += ['-b:a', compat_str(max(6, int((9 - int(self._preferredquality)) * 24))) + 'k']
|
||||
else:
|
||||
more_opts += ['-q:a', self._preferredquality]
|
||||
else:
|
||||
more_opts += ['-b:a', self._preferredquality + 'k']
|
||||
|
Loading…
Reference in New Issue
Block a user