mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-11-30 12:01:28 +00:00
[ExtractAudio] Use libfdk_aac
if available
Closes #1502 Authored by: CrypticSignal
This commit is contained in:
parent
9af98e17bd
commit
673c0057e8
|
@ -99,7 +99,7 @@ def get_ffmpeg_version(path, prog):
|
|||
if prog != 'ffmpeg' or not out:
|
||||
return
|
||||
|
||||
# TODO: Feature detection
|
||||
self._features['fdk'] = '--enable-libfdk-aac' in out
|
||||
|
||||
self.basename = None
|
||||
self.probe_basename = None
|
||||
|
@ -391,6 +391,7 @@ def _quality_args(self, codec):
|
|||
# Experimentally, with values over 4, bitrate changes were minimal or non-existent
|
||||
'aac': (0.1, 4),
|
||||
'vorbis': (0, 10),
|
||||
'libfdk_aac': (1, 5),
|
||||
'opus': None, # doesn't support -q:a
|
||||
'wav': None,
|
||||
'flac': None,
|
||||
|
@ -399,6 +400,8 @@ def _quality_args(self, codec):
|
|||
return []
|
||||
|
||||
q = limits[1] + (limits[0] - limits[1]) * (self._preferredquality / 10)
|
||||
if codec == 'libfdk_aac':
|
||||
return ['-vbr', f'{int(q)}']
|
||||
return ['-q:a', f'{q}']
|
||||
|
||||
def run_ffmpeg(self, path, out_path, codec, more_opts):
|
||||
|
@ -448,6 +451,8 @@ def run(self, information):
|
|||
else:
|
||||
# We convert the audio (lossy if codec is lossy)
|
||||
acodec = ACODECS[self._preferredcodec]
|
||||
if acodec == 'aac' and self._features.get('fdk'):
|
||||
acodec = 'libfdk_aac'
|
||||
extension = self._preferredcodec
|
||||
more_opts = self._quality_args(acodec)
|
||||
if self._preferredcodec == 'aac':
|
||||
|
|
Loading…
Reference in a new issue