# -*- coding: utf-8 -*- """ 裁剪视频:丢弃前30分钟,保留后面部分 """ import subprocess from pathlib import Path import imageio_ffmpeg FFMPEG_PATH = imageio_ffmpeg.get_ffmpeg_exe() # 输入输出(直接覆盖原文件) input_file = Path(r"D:\AA_Work\AIEC-团队开发规范Skills\视频分割\原视频\20251209135052-信通院云大所市场部-张媛媛预定的会议-视频-1.mp4") temp_file = input_file.with_suffix('.tmp.mp4') # 丢弃前30分钟 skip_seconds = 30 * 60 # 30分钟 cmd = [ FFMPEG_PATH, '-y', '-ss', str(skip_seconds), # 跳过前30分钟 '-i', str(input_file), '-c', 'copy', # 不重新编码,速度快 '-avoid_negative_ts', 'make_zero', str(temp_file) ] print(f"文件: {input_file.name}") print(f"跳过前 30 分钟,裁剪中...") subprocess.run(cmd) # 替换原文件 import os os.remove(input_file) temp_file.rename(input_file) print("完成! 原文件已更新")