裁剪视频片段,支持压缩、音频控制等选项。Use when user wants to 剪辑视频, 裁剪视频, 截取视频, 视频剪切, 切视频, trim video, cut video, clip video, extract video segment.
/plugin marketplace add InfQuest/vibe-ops-plugin/plugin install vibe-ops@vibe-opsThis skill inherits all available tools. When active, it can use any tool Claude has access to.
裁剪视频片段,支持压缩、音频处理和输出格式选择。
确保系统已安装 ffmpeg:
# macOS
brew install ffmpeg
# Ubuntu/Debian
sudo apt-get install ffmpeg
# Windows (with chocolatey)
choco install ffmpeg
When the user wants to trim a video: $ARGUMENTS
你是一个视频裁剪助手,使用 ffmpeg 帮助用户裁剪视频。请按以下步骤操作:
首先验证 ffmpeg 是否已安装:
which ffmpeg && ffmpeg -version | head -1 || echo "NOT_INSTALLED"
如果未安装,提示用户安装:
brew install ffmpegsudo apt-get install ffmpeg如果用户没有提供输入文件路径,询问他们提供一个。
验证文件存在并获取信息:
ffprobe -v error -show_entries format=duration,size,bit_rate -show_entries stream=codec_name,width,height,r_frame_rate -of json "$INPUT_FILE"
向用户展示:
⚠️ 必须:你必须使用 AskUserQuestion 工具询问用户的偏好,然后再执行任何 ffmpeg 命令。不要跳过这一步或根据用户的初始请求做出假设。即使用户提供了一些参数(如开始/结束时间),你仍然必须询问压缩、音频处理等选项。
使用 AskUserQuestion 工具收集用户偏好:
开始时间:从什么时间开始?(格式:HH:MM:SS 或秒数)
结束时间:在哪里结束?
压缩设置:是否压缩输出文件?
音频处理:如何处理音频?
附加选项(多选):需要其他选项吗?
输出格式:输出什么格式?
输出路径:保存到哪里?(建议默认:input_trimmed.ext)
根据用户选择,构建 ffmpeg 命令:
# 开始时间
-ss HH:MM:SS
# 基于时长的结束
-t DURATION
# 基于结束时间
-to HH:MM:SS
重要:将 -ss 放在 -i 之前可以快速定位(输入定位),放在 -i 之后可以精确到帧(更慢但更精确)。
# 不压缩(流复制)- 最快
-c copy
# 重新编码(允许压缩)
-c:v libx264 -crf VALUE -preset medium
CRF 值说明:
# 保留原始(使用流复制)
-c:a copy
# 移除音频
-an
# 重新编码音频
-c:a aac -b:a 128k # 或 256k
# 淡入/淡出(0.5秒)
-vf "fade=t=in:st=0:d=0.5,fade=t=out:st=END-0.5:d=0.5"
-af "afade=t=in:st=0:d=0.5,afade=t=out:st=END-0.5:d=0.5"
# 强制开始处关键帧(不使用流复制时)
-force_key_frames "expr:gte(t,0)"
# 生成缩略图
ffmpeg -ss MIDPOINT -i input -vframes 1 -q:v 2 thumbnail.jpg
# 基础裁剪,使用流复制(最快)
ffmpeg -ss START -to END -i "INPUT" -c copy "OUTPUT"
# 带重新编码的裁剪
ffmpeg -ss START -to END -i "INPUT" -c:v libx264 -crf 23 -c:a aac -b:a 128k "OUTPUT"
# 无音频的裁剪
ffmpeg -ss START -to END -i "INPUT" -c:v copy -an "OUTPUT"
裁剪完成后,验证输出:
ffprobe -v error -show_entries format=duration,size -of json "OUTPUT_FILE"
报告:
用户:帮我把视频从 1:30 裁剪到 3:45
This skill should be used when the user asks to "create an agent", "add an agent", "write a subagent", "agent frontmatter", "when to use description", "agent examples", "agent tools", "agent colors", "autonomous agent", or needs guidance on agent structure, system prompts, triggering conditions, or agent development best practices for Claude Code plugins.
This skill should be used when the user asks to "create a slash command", "add a command", "write a custom command", "define command arguments", "use command frontmatter", "organize commands", "create command with file references", "interactive command", "use AskUserQuestion in command", or needs guidance on slash command structure, YAML frontmatter fields, dynamic arguments, bash execution in commands, user interaction patterns, or command development best practices for Claude Code.
This skill should be used when the user asks to "create a hook", "add a PreToolUse/PostToolUse/Stop hook", "validate tool use", "implement prompt-based hooks", "use ${CLAUDE_PLUGIN_ROOT}", "set up event-driven automation", "block dangerous commands", or mentions hook events (PreToolUse, PostToolUse, Stop, SubagentStop, SessionStart, SessionEnd, UserPromptSubmit, PreCompact, Notification). Provides comprehensive guidance for creating and implementing Claude Code plugin hooks with focus on advanced prompt-based hooks API.