libfdkaac transcode support added.

This commit is contained in:
Istvan Nagy 2015-03-15 18:13:58 +01:00
parent 3b4444f99a
commit 8544f1a915
2 changed files with 17 additions and 2 deletions

View File

@ -162,7 +162,7 @@ def _real_main(argv=None):
if opts.playlistend not in (-1, None) and opts.playlistend < opts.playliststart:
raise ValueError('Playlist end must be greater than playlist start')
if opts.extractaudio:
if opts.audioformat not in ['best', 'aac', 'mp3', 'm4a', 'opus', 'vorbis', 'wav']:
if opts.audioformat not in ['best', 'aac', 'libfdkaac', 'libfdkaac-he', 'libfdkaac-hev2', 'mp3', 'm4a', 'opus', 'vorbis', 'wav']:
parser.error('invalid audio format specified')
if opts.audioquality:
opts.audioquality = opts.audioquality.strip('k').strip('K')

View File

@ -237,7 +237,7 @@ class FFmpegExtractAudioPP(FFmpegPostProcessor):
more_opts += ['-b:a', self._preferredquality + 'k']
else:
# We convert the audio (lossy)
acodec = {'mp3': 'libmp3lame', 'aac': 'aac', 'm4a': 'aac', 'opus': 'opus', 'vorbis': 'libvorbis', 'wav': None}[self._preferredcodec]
acodec = {'mp3': 'libmp3lame', 'aac': 'aac', 'm4a': 'aac', 'opus': 'opus', 'vorbis': 'libvorbis', 'wav': None, 'libfdkaac': None, 'libfdkaac-he': None, 'libfdkaac-hev2': None}[self._preferredcodec]
extension = self._preferredcodec
more_opts = []
if self._preferredquality is not None:
@ -255,6 +255,21 @@ class FFmpegExtractAudioPP(FFmpegPostProcessor):
if self._preferredcodec == 'wav':
extension = 'wav'
more_opts += ['-f', 'wav']
if self._preferredcodec == 'libfdkaac' or self._preferredcodec == 'libfdkaac-he' or self._preferredcodec == 'libfdkaac-hev2':
more_opts = []
acodec = 'libfdk_aac'
prefix, sep, ext = path.rpartition('.')
if (ext == 'm4a'):
extension = 'libfdkaac.m4a'
if self._preferredquality is not None:
if int(self._preferredquality) < 6:
more_opts += ['-vbr', self._preferredquality]
else:
more_opts += ['-b:a', self._preferredquality + 'k']
if self._preferredcodec == 'libfdkaac-he':
more_opts += ['-profile:a', 'aac_he']
elif self._preferredcodec == 'libfdkaac-hev2':
more_opts += ['-profile:a', 'aac_he_v2']
prefix, sep, ext = path.rpartition('.') # not os.path.splitext, since the latter does not work on unicode in all setups
new_path = prefix + sep + extension