clip_video
Extract specific segments from videos using start and end times or duration. Supports multiple time formats, enables custom output paths, and integrates with FFmpeg for precise video trimming.
Instructions
智能视频剪辑函数
参数:
video_path : str - 源视频文件路径
start : int/float/str - 开始时间(支持秒数、MM:SS、HH:MM:SS格式,默认为视频开头,如果不传该参数,或者该参数为负数,从视频结尾往前剪辑)
end : int/float/str - 结束时间(同上,默认为视频结尾)
duration: int/float/str - 裁剪时长,end和duration必须有一个
output_path: str - 裁剪后视频输出路径,如果不传入,会有一个默认的输出路径
time_out: int - 命令行执行超时时间,默认为300s
返回:
error - 错误码
str - ffmpeg执行过程中所有日志
str - 生成的剪辑文件路径
示例:
clip_video("input.mp4", "00:01:30", "02:30")
Input Schema
Name | Required | Description | Default |
---|---|---|---|
duration | No | ||
end | No | ||
output_path | No | ||
start | No | ||
time_out | No | ||
video_path | Yes |
Input Schema (JSON Schema)
{
"properties": {
"duration": {
"default": null,
"title": "duration",
"type": "string"
},
"end": {
"default": null,
"title": "end",
"type": "string"
},
"output_path": {
"default": null,
"title": "output_path",
"type": "string"
},
"start": {
"default": null,
"title": "start",
"type": "string"
},
"time_out": {
"default": 300,
"title": "time_out",
"type": "string"
},
"video_path": {
"title": "video_path",
"type": "string"
}
},
"required": [
"video_path"
],
"title": "clip_videoArguments",
"type": "object"
}