from pydub import AudioSegment
sound = AudioSegment.from_file('/input/file')
sound.export('/output/file', format='mp3', bitrate='128k')
Python library for converting files to MP3 and setting their quality