安装库

sudo pip install moviepy

代码 index.py

from moviepy.editor import *

video = VideoFileClip('test.mp4')
audio = video.audio
audio.write_audiofile('test.mp3')

运行

python3 index.py

结果

➜  py python3 index.py
MoviePy - Writing audio in test.mp3
MoviePy - Done.
05-16 01:51