Commit 5cb54f88 authored by fred's avatar fred

revert bitrate conversion scale to match mp3 encoder

parent b44ec973
......@@ -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)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment