pip install moviepy
movie_to_mp3.py
#!/usr/bin/env python #-*- coding:utf-8 -*- # 提取视频中的音频 # pip install moviepy from moviepy.editor import AudioFileClip input_file = "D:/work/project/python/test.mp4" audio = AudioFileClip(input_file) audio.write_audiofile("D:/work/project/python/test1.wav") #提取的是无损文件 audio.write_audiofile("D:/work/project/python/test.mp3") #提取的是有损文件