# 批量avi格式视频转mp4格式import os
from moviepy.editor import VideoFileClip
video_folder =r'视频文件路径'
avi_files =[f for f in os.listdir(video_folder)if f.endswith('.avi')]for avi_file in avi_files:avi_path = os.path.join(video_folder, avi_file)mp4_path = os.path.join(video_folder, avi_file.rsplit('.',1)[0]+'.mp4')avi_clip = VideoFileClip(avi_path)avi_clip.write_videofile(mp4_path, codec='libx264')avi_clip.close()print("转换完成")