将一个长视频批量处理成短视频 python
import subprocess
# 视频文件路径
video_path = "video.mp4"
# 切片时长(单位:秒)
duration = 25
# 输出文件名格式
output_format = "mv/output_%03d.mp4"
# 调用FFmpeg命令行工具进行视频切片
subprocess.call(
[
"ffmpeg",
"-i",
video_path,
"-c",
"copy",
"-map",
"0",
"-segment_time",
str(duration),
"-f",
"segment",
output_format,
]
)