Python convert wav to mp3

November 16, 2020

How to convert wav to mp3 using Python.

Before you can use the script, you must install dependencies:

Install ffmpeg

Mac

brew install ffmpeg

Linux

sudo apt-get install ffmpeg

Install pydub

pip install pydub

Script:

from pydub import AudioSegment

AudioSegment.from_wav("example.wav").export("example.mp3", format="mp3")
```

Search