import os import subprocess input_dir = r"D:\CRVideoMate Output\" output_dir = r"D:\CRVideoMate Output\Final" # 创建输出目录 os.makedirs(output_dir, exist_ok=True) for file in os.listdir(input_dir): if file.endswith(".mp4"): input_file = os.path.join(input_dir, file) output_file = os.path.join( output_dir, file.replace(".mp4", ".mp4") ) # 剪切的起始坐标 x = 0 y = 0 # 请根据实际需求调整 # FFmpeg命令 ffmpeg_command = [ "ffmpeg", "-i", input_file, "-filter:v", f"crop=1080:1920:{x}:{y}", "-c:v", "libx264", "-c:a", "aac", "-y", output_file, ] # 执行FFmpeg命令 subprocess.run(ffmpeg_command) print("Conversion completed.") # debug #ffmpeg -i input.mp4 -filter:v "crop=1920:1080:0:180" output.mp4