From 5cb54f88e8acb255f927893fda103dafe7627ac4 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Fr=C3=A9d=C3=A9ric=20P=C3=A9ters?= Date: Sat, 4 Apr 2020 15:36:49 +0200 Subject: [PATCH] revert bitrate conversion scale to match mp3 encoder --- emissions/management/commands/create-sound-files.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/emissions/management/commands/create-sound-files.py b/emissions/management/commands/create-sound-files.py index e59a9f0..84799f6 100644 --- a/emissions/management/commands/create-sound-files.py +++ b/emissions/management/commands/create-sound-files.py @@ -123,23 +123,24 @@ class Command(BaseCommand): vorbis_rates = [64, 80, 96, 112, 128, 160, 192, 224, 256, 320, 500] orig_bitrate = get_bitrate(soundfile.file.path) vorbis_q = 5 - mp3_q = 4 if orig_bitrate is not None: if soundfile.episode.emission.podcast_sound_quality == 'high': vorbis_q = 9 - mp3_q = 9 # cap quality to original bitrate (using vorbis quality mapping) for i, rate in enumerate(vorbis_rates): if orig_bitrate < rate: vorbis_q = min((i, vorbis_q)) - mp3_q = min((i, mp3_q)) break cmd = ['ffmpeg', '-y', '-i', soundfile.file.path] if format == 'ogg': cmd.extend(['-q:a', str(vorbis_q)]) elif format == 'mp3': - cmd.extend(['-q:a', str(mp3_q)]) + mp3_q = 9 - vorbis_q + if mp3_q == 0: + cmd.extend(['-b:a', '320k']) + else: + cmd.extend(['-q:a', str(mp3_q)]) cmd.append(file_path) -- 2.39.2