mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-11-14 11:07:56 +01: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:
|
if prog != 'ffmpeg' or not out:
|
||||||
return
|
return
|
||||||
|
|
||||||
# TODO: Feature detection
|
self._features['fdk'] = '--enable-libfdk-aac' in out
|
||||||
|
|
||||||
self.basename = None
|
self.basename = None
|
||||||
self.probe_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
|
# Experimentally, with values over 4, bitrate changes were minimal or non-existent
|
||||||
'aac': (0.1, 4),
|
'aac': (0.1, 4),
|
||||||
'vorbis': (0, 10),
|
'vorbis': (0, 10),
|
||||||
|
'libfdk_aac': (1, 5),
|
||||||
'opus': None, # doesn't support -q:a
|
'opus': None, # doesn't support -q:a
|
||||||
'wav': None,
|
'wav': None,
|
||||||
'flac': None,
|
'flac': None,
|
||||||
@ -399,6 +400,8 @@ def _quality_args(self, codec):
|
|||||||
return []
|
return []
|
||||||
|
|
||||||
q = limits[1] + (limits[0] - limits[1]) * (self._preferredquality / 10)
|
q = limits[1] + (limits[0] - limits[1]) * (self._preferredquality / 10)
|
||||||
|
if codec == 'libfdk_aac':
|
||||||
|
return ['-vbr', f'{int(q)}']
|
||||||
return ['-q:a', f'{q}']
|
return ['-q:a', f'{q}']
|
||||||
|
|
||||||
def run_ffmpeg(self, path, out_path, codec, more_opts):
|
def run_ffmpeg(self, path, out_path, codec, more_opts):
|
||||||
@ -448,6 +451,8 @@ def run(self, information):
|
|||||||
else:
|
else:
|
||||||
# We convert the audio (lossy if codec is lossy)
|
# We convert the audio (lossy if codec is lossy)
|
||||||
acodec = ACODECS[self._preferredcodec]
|
acodec = ACODECS[self._preferredcodec]
|
||||||
|
if acodec == 'aac' and self._features.get('fdk'):
|
||||||
|
acodec = 'libfdk_aac'
|
||||||
extension = self._preferredcodec
|
extension = self._preferredcodec
|
||||||
more_opts = self._quality_args(acodec)
|
more_opts = self._quality_args(acodec)
|
||||||
if self._preferredcodec == 'aac':
|
if self._preferredcodec == 'aac':
|
||||||
|
Loading…
Reference in New Issue
Block a user