以下是用 Python 处理 FFmpeg 命令行的代码,用于从视频文件中提取指定片段:

import subprocess

input_file = 'input.mp4'
output_file = 'output.mp4'
start_time = '00:01:35'
duration = '00:22:27'

command = ['ffmpeg', '-i', input_file, '-ss', start_time, '-t', duration, '-c', 'copy', output_file]
subprocess.call(command)

请注意,在运行此代码之前,确保已安装 FFmpeg 并将其添加到系统的路径中。

Python 使用 FFmpeg 剪辑视频片段

原文地址: https://www.cveoy.top/t/topic/nJRB 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录