1、下载pydub:pip install pydub

2、下载与操作系统一致的ffmpeg:http://ffmpeg.org/download.html

3、解压后将下载的ffmpeg下的bin目录路径添加到path的环境变量中

python中mp3转wav(Couldn't find ffmpeg or avconv - defaulting to ffmpeg, but may not work")-LMLPHP

4、代码如下

 from pydub import AudioSegment

 sound = AudioSegment.from_mp3('C:/Users/Desktop/song1.mp3')
sound.export('song/song1.wav', format='wav')

python中mp3转wav(Couldn't find ffmpeg or avconv - defaulting to ffmpeg, but may not work")-LMLPHP

5、ffmpeg报错是因为没下载ffmpeg或下载方式不对或路径没找到或未配置路径等引起的

05-11 15:24