0条评论
还没有人评论过~
mp3转pcm格式python3的文档哪位同学有
安装ffmpy,使用ffmpeg转化(https://ffmpeg.org/download.html#build-windows)
将下载的ffmpeg.exe放在项目下面的scripts目录下
from ffmpy import FFmpeg
#将mp3转化没pcm
ff = FFmpeg(inputs={r'd:\test\venv\Scripts\test.mp3':"-y"},
outputs={r'd:\test\venv\Scripts\test.pcm':"-acodec pcm_s16le -f s16le -ac 2 -ar 16000"})
print(ff.cmd)
ff.run()
#将pcm转化为mp3
ff1 = FFmpeg(inputs={r'd:\test\venv\Scripts\test.pcm':"-y -f s16be -ac 2 -ar 16000 -acodec pcm_s16le"},
outputs={r'd:\test\venv\Scripts\test1.mp3':None})
print(ff1.cmd)
ff1.run()
参数说明:https://blog.csdn.net/weixin_33890499/article/details/88708622
参考 Python: How to decode a mp3 chunk into PCM samples?