From e8bebe0b03d256371c38a983d7a6d2147d827cba Mon Sep 17 00:00:00 2001 From: Alex Richards Date: Tue, 15 Aug 2023 13:15:42 -0700 Subject: [PATCH] [postprocessor/ffmpeg] Allow options for mp3 Why? Options like `preferredquality` are ignored when postprocessing mp3s. What? Remove `mp3` from the list of `filecodec` values to check for in the "lossless" condition unless `preferredquality` is unspecified. --- youtube_dl/postprocessor/ffmpeg.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/youtube_dl/postprocessor/ffmpeg.py b/youtube_dl/postprocessor/ffmpeg.py index 801160e6c..a5ac14fa9 100644 --- a/youtube_dl/postprocessor/ffmpeg.py +++ b/youtube_dl/postprocessor/ffmpeg.py @@ -284,7 +284,10 @@ class FFmpegExtractAudioPP(FFmpegPostProcessor): acodec = 'copy' extension = 'm4a' more_opts = ['-bsf:a', 'aac_adtstoasc'] - elif filecodec in ['aac', 'flac', 'mp3', 'vorbis', 'opus']: + elif ( + filecodec in ['aac', 'flac', 'vorbis', 'opus'] or + (filecodec == 'mp3' and self._preferredquality is None) + ): # Lossless if possible acodec = 'copy' extension = filecodec