python中mp4转mp3,直接上代码
from moviepy.editor import VideoFileClipdef video_to_audio(video_path, audio_path):video_clip = VideoFileClip(video_path)audio = video_clip.audioaudio.write_audiofile(audio_path)video_path = '1.mp4' # 视频文件路径
audio_path = '2.mp3' # 输出音频文件路径video_to_audio(video_path, audio_path)