-
-
Save neyhart/e62c39806354d3fc0fe95f8cd7fd5110 to your computer and use it in GitHub Desktop.
Simple python ffmpeg conversion script. From flac to mp3, aac and opus
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
aac_cmd = 'ffmpeg -i "{file_name}" -c:a aac -b:a 256k aac/{output_name}.aac' | |
opus_cmd = 'ffmpeg -i "{file_name}" -c:a libopus -b:a 96k ./opus/{output_name}.opus' | |
mp3_cmd = 'ffmpeg -i "{file_name}" -c:a mp3 -b:a 128k ./mp3/{output_name}.mp3' | |
for d in ('mp3', 'opus', 'aac'): | |
os.mkdir(d) | |
counter = 1 | |
for f in [x for x in os.listdir() if os.path.isfile(x) if '.flac' in x]: | |
os.system(aac_cmd.format(file_name=f, output_name=counter.__str__())) | |
os.system(opus_cmd.format(file_name=f, output_name=counter.__str__())) | |
os.system(mp3_cmd.format(file_name=f, output_name=counter.__str__())) | |
counter += 1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment