jiaaro / pydub

Manipulate audio with a simple and easy high level interface
http://pydub.com
MIT License
8.82k stars 1.04k forks source link

MP3 exports unreadable/corrupted #806

Open Koowah opened 1 month ago

Koowah commented 1 month ago

Steps to reproduce

from pydub import AudioSegment

def main():
    mp3_file_path = "tests/146218705.mp3"
    wav_file_path = mp3_file_path.replace("mp3", "wav")
    new_mp3_file_path = mp3_file_path.replace(".mp3", "_new.mp3")

    sound = AudioSegment.from_mp3(mp3_file_path)
    sound.export(wav_file_path, format="wav")

    sound = AudioSegment.from_wav(wav_file_path)
    sound.export(new_mp3_file_path, format="mp3")

if __name__ == "__main__":
    main()

Expected behavior

I should be able to export AudioSegments to mp3

Actual behavior

All mp3 exports are corrupted or unreadable. There is no problem with wav exports.

Your System configuration

Is there an audio file you can include to help us reproduce?

Any audio should do the trick - I tried many coming from different sources.

To be noted

I installed ffmpeg using conda-forge

Koowah commented 1 month ago

Installing ffmpeg build manually and adding its bins to PATH fixed the issue.

For anyone interested here's a tutorial. The gyan.dev build that the tutorial uses is suggested for windows installation on the official ffmpeg website.