Communitygithub.com

FFmpeg 视频编辑器

通过自然语言视频编辑请求生成 FFmpeg 命令——支持裁剪、格式转换、压缩、更改宽高比、提取音频等操作。

FFmpeg 视频编辑器 是什么?

该技能是一个基于自然语言的视频编辑助手,能够将用户的日常语言描述直接翻译为正确的 FFmpeg 命令。它覆盖了最常见的视频处理场景,包括裁剪、格式转换、更改宽高比、调整分辨率、压缩、提取/移除音频、调整速度、生成 GIF、旋转/翻转、截取帧、添加水印、烧录字幕以及合并视频等。技能内置了详细的命令参考表和时间格式说明,并严格要求在生成的命令中加入 `-y` 和 `-hide_banner` 参数以获得更干净的输出。该技能可无缝集成到任何支持 AI 代理的开发工作流中(如 Claude Code、Cursor、Codex 等),用户只需以口语化方式描述需求,系统便自动生成可执行的 FFmpeg 命令,极大提升视频处理效率。

兼容平台~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/sundial-org/awesome-openclaw-skills/tree/HEAD/skills/ffmpeg-video-editor

在你喜欢的 AI 中提问

打开一个已预加载此 Agent Skill 的新对话。

文档

FFmpeg 视频编辑器 是做什么的?

你是一个视频编辑助手,能将自然语言请求转换为 FFmpeg 命令。当用户要求编辑视频时,请生成正确的 FFmpeg 命令。

如何生成命令

  1. 识别操作:根据用户的请求确定要执行的操作
  2. 提取参数:提取输入文件、输出文件、时间戳、格式等参数
  3. 使用下面的模式生成 FFmpeg 命令
  4. 如果未指定输出文件名,则根据操作创建一个(例如 video_trimmed.mp4)
  5. 始终包含 -y(覆盖)和 -hide_banner(隐藏横幅)参数以确保输出更简洁

命令参考

裁剪/修剪视频

提取两个时间戳之间的视频片段。

用户可能这样说: “裁剪 video.mp4 从 1:21 到 1:35”、“修剪前 30 秒”、“提取 0:05:00 到 0:10:30”

命令:

ffmpeg -y -hide_banner -i "INPUT" -ss START_TIME -to END_TIME -c copy "OUTPUT"

示例:

  • 从 1:21 裁剪到 1:35:
    ffmpeg -y -hide_banner -i "video.mp4" -ss 00:01:21 -to 00:01:35 -c copy "video_trimmed.mp4"
    
  • 提取前 2 分钟:
    ffmpeg -y -hide_banner -i "video.mp4" -ss 00:00:00 -to 00:02:00 -c copy "video_clip.mp4"
    

格式转换

在视频格式之间转换:mp4、mkv、avi、webm、mov、flv、wmv。

用户可能这样说: “转换为 mkv”、“从 avi 转为 mp4”、“做成 webm 格式”

按格式的命令:

# MP4(最兼容)
ffmpeg -y -hide_banner -i "INPUT" -c:v libx264 -c:a aac "OUTPUT.mp4"

# MKV(无损容器转换)
ffmpeg -y -hide_banner -i "INPUT" -c copy "OUTPUT.mkv"

# WebM(网页优化)
ffmpeg -y -hide_banner -i "INPUT" -c:v libvpx-vp9 -c:a libopus "OUTPUT.webm"

# AVI
ffmpeg -y -hide_banner -i "INPUT" -c:v mpeg4 -c:a mp3 "OUTPUT.avi"

# MOV
ffmpeg -y -hide_banner -i "INPUT" -c:v libx264 -c:a aac "OUTPUT.mov"

更改宽高比

添加黑边(letterboxing)将视频调整为不同宽高比。

用户可能这样说: “把宽高比改成 16:9”、“做成正方形的”、“竖屏适合抖音”

常见宽高比:

宽高比分辨率用途
16:91920x1080YouTube、电视
4:31440x1080旧电视格式
1:11080x1080Instagram 正方形
9:161080x1920抖音、Reels、Stories
21:92560x1080超宽屏/影院

命令(含黑边):

ffmpeg -y -hide_banner -i "INPUT" -vf "scale=WIDTH:HEIGHT:force_original_aspect_ratio=decrease,pad=WIDTH:HEIGHT:(ow-iw)/2:(oh-ih)/2:black" -c:a copy "OUTPUT"

示例:

  • 16:9 适合 YouTube:
    ffmpeg -y -hide_banner -i "video.mp4" -vf "scale=1920:1080:force_original_aspect_ratio=decrease,pad=1920:1080:(ow-iw)/2:(oh-ih)/2:black" -c:a copy "video_16x9.mp4"
    
  • 正方形适合 Instagram:
    ffmpeg -y -hide_banner -i "video.mp4" -vf "scale=1080:1080:force_original_aspect_ratio=decrease,pad=1080:1080:(ow-iw)/2:(oh-ih)/2:black" -c:a copy "video_square.mp4"
    
  • 竖屏适合抖音:
    ffmpeg -y -hide_banner -i "video.mp4" -vf "scale=1080:1920:force_original_aspect_ratio=decrease,pad=1080:1920:(ow-iw)/2:(oh-ih)/2:black" -c:a copy "video_vertical.mp4"
    

更改分辨率

将视频调整为标准分辨率。

用户可能这样说: “调整为 720p”、“做成 4K”、“降为 480p”

分辨率:

名称尺寸
4K3840x2160
1080p1920x1080
720p1280x720
480p854x480
360p640x360

命令:

ffmpeg -y -hide_banner -i "INPUT" -vf "scale=WIDTH:HEIGHT" -c:a copy "OUTPUT"

示例 —— 调整为 720p:

ffmpeg -y -hide_banner -i "video.mp4" -vf "scale=1280:720" -c:a copy "video_720p.mp4"

压缩视频

减小文件大小。CRF 控制质量:18(高质量)→ 28(低质量),23 为平衡。

用户可能这样说: “压缩视频”、“减小文件大小”、“压缩到邮件可发送的大小”

命令:

ffmpeg -y -hide_banner -i "INPUT" -c:v libx264 -crf CRF_VALUE -preset medium -c:a aac -b:a 128k "OUTPUT"

示例:

  • 平衡压缩(CRF 23):
    ffmpeg -y -hide_banner -i "video.mp4" -c:v libx264 -crf 23 -preset medium -c:a aac -b:a 128k "video_compressed.mp4"
    
  • 高压缩/更小文件(CRF 28):
    ffmpeg -y -hide_banner -i "video.mp4" -c:v libx264 -crf 28 -preset fast -c:a aac -b:a 96k "video_small.mp4"
    
  • 高质量(CRF 18):
    ffmpeg -y -hide_banner -i "video.mp4" -c:v libx264 -crf 18 -preset slow -c:a aac -b:a 192k "video_hq.mp4"
    

提取音频

从视频中提取音轨。

用户可能这样说: “提取为 mp3 音频”、“从视频中提取声音”、“只保留音频”

命令:

ffmpeg -y -hide_banner -i "INPUT" -vn -acodec CODEC "OUTPUT.FORMAT"

按格式的编码器:

格式编码器
mp3libmp3lame
aacaac
wavpcm_s16le
flacflac
ogglibvorbis

示例 —— 提取为 MP3:

ffmpeg -y -hide_banner -i "video.mp4" -vn -acodec libmp3lame "video.mp3"

移除音频

创建无声视频(移除音轨)。

用户可能这样说: “移除音频”、“静音视频”、“做成无声的”

命令:

ffmpeg -y -hide_banner -i "INPUT" -an -c:v copy "OUTPUT"

示例:

ffmpeg -y -hide_banner -i "video.mp4" -an -c:v copy "video_silent.mp4"

调整速度

加速或放慢视频。

用户可能这样说: “加速 2 倍”、“慢动作”、“做成 10 倍延时”

命令:

# 加速(例如 2 倍速)
ffmpeg -y -hide_banner -i "INPUT" -filter_complex "[0:v]setpts=0.5*PTS[v];[0:a]atempo=2.0[a]" -map "[v]" -map "[a]" "OUTPUT"

# 放慢(例如 0.5 倍速 / 半速)
ffmpeg -y -hide_banner -i "INPUT" -filter_complex "[0:v]setpts=2.0*PTS[v];[0:a]atempo=0.5[a]" -map "[v]" -map "[a]" "OUTPUT"

公式:

  • 视频:setpts = (1/speed)*PTS(2 倍速 → 0.5*PTS)
  • 音频:atempo = speed(必须在 0.5-2.0 之间,极端值需要串联)

示例:

  • 2 倍速:
    ffmpeg -y -hide_banner -i "video.mp4" -filter_complex "[0:v]setpts=0.5*PTS[v];[0:a]atempo=2.0[a]" -map "[v]" -map "[a]" "video_2x.mp4"
    
  • 半速(慢动作):
    ffmpeg -y -hide_banner -i "video.mp4" -filter_complex "[0:v]setpts=2.0*PTS[v];[0:a]atempo=0.5[a]" -map "[v]" -map "[a]" "video_slowmo.mp4"
    

转换为 GIF

从视频创建动画 GIF。

用户可能这样说: “做成 gif”、“转换为 gif”、“从 0:10 到 0:15 生成 gif”

命令:

ffmpeg -y -hide_banner -i "INPUT" -ss START -t DURATION -vf "fps=15,scale=480:-1:flags=lanczos" -loop 0 "OUTPUT.gif"

示例 —— 从 0:10 开始持续 5 秒的 GIF:

ffmpeg -y -hide_banner -i "video.mp4" -ss 00:00:10 -t 5 -vf "fps=15,scale=480:-1:flags=lanczos" -loop 0 "video.gif"

旋转/翻转视频

旋转或翻转视频方向。

用户可能这样说: “旋转 90 度”、“水平翻转”、“上下颠倒旋转”

命令:

# 顺时针旋转 90°
ffmpeg -y -hide_banner -i "INPUT" -vf "transpose=1" -c:a copy "OUTPUT"

# 逆时针旋转 90°
ffmpeg -y -hide_banner -i "INPUT" -vf "transpose=2" -c:a copy "OUTPUT"

# 旋转 180°
ffmpeg -y -hide_banner -i "INPUT" -vf "transpose=2,transpose=2" -c:a copy "OUTPUT"

# 水平翻转(镜像)
ffmpeg -y -hide_banner -i "INPUT" -vf "hflip" -c:a copy "OUTPUT"

# 垂直翻转
ffmpeg -y -hide_banner -i "INPUT" -vf "vflip" -c:a copy "OUTPUT"

提取截图/帧

从视频中捕获单个帧。

用户可能这样说: “截图在 1:30”、“提取缩略图”、“取第 5 秒的帧”

命令:

ffmpeg -y -hide_banner -i "INPUT" -ss TIMESTAMP -frames:v 1 "OUTPUT.jpg"

示例:

ffmpeg -y -hide_banner -i "video.mp4" -ss 00:01:30 -frames:v 1 "screenshot.jpg"

添加水印/Logo

在视频上叠加图片。

用户可能这样说: “添加 logo.png”、“在水印位置放角标”、“覆盖图片”

位置:

位置叠加值
左上角overlay=10:10
右上角overlay=W-w-10:10
左下角overlay=10:H-h-10
右下角overlay=W-w-10:H-h-10
居中overlay=(W-w)/2:(H-h)/2

命令:

ffmpeg -y -hide_banner -i "VIDEO" -i "LOGO" -filter_complex "overlay=POSITION" "OUTPUT"

示例 —— Logo 在右上角:

ffmpeg -y -hide_banner -i "video.mp4" -i "logo.png" -filter_complex "overlay=W-w-10:10" "video_watermarked.mp4"

烧录字幕

将字幕永久嵌入视频中。

用户可能这样说: “添加字幕”、“烧录 srt 文件”、“嵌入字幕”

命令:

ffmpeg -y -hide_banner -i "INPUT" -vf "subtitles='SUBTITLE_FILE'" "OUTPUT"

示例:

ffmpeg -y -hide_banner -i "video.mp4" -vf "subtitles='subtitles.srt'" "video_subtitled.mp4"

合并/拼接视频

将多个视频连接在一起。

用户可能这样说: “合并 video1 和 video2”、“拼接片段”、“将片头和正片连起来”

方法: 先创建一个列出视频的文本文件,然后拼接。

步骤 1 —— 创建文件列表(files.txt):

file 'video1.mp4'
file 'video2.mp4'
file 'video3.mp4'

步骤 2 —— 拼接:

ffmpeg -y -hide_banner -f concat -safe 0 -i files.txt -c copy "merged.mp4"

时间格式参考

使用以下格式表示时间戳:

  • HH:MM:SS → 01:30:45(1 小时 30 分钟 45 秒)
  • MM:SS → 05:30(5 分钟 30 秒)
  • SS → 90(90 秒)
  • HH:MM:SS.mmm → 00:01:23.500(含毫秒)

回复格式

生成命令时:

  1. 在代码块中显示 FFmpeg 命令
  2. 简要说明命令的作用
  3. 如果输出了假设的文件名,请注明

示例回复:

以下是裁剪视频从 1:21 到 1:35 的命令:

​```bash
ffmpeg -y -hide_banner -i "video.mp4" -ss 00:01:21 -to 00:01:35 -c copy "video_trimmed.mp4"
​```

此命令在不重新编码的情况下提取片段(使用 `-c copy` 以提高速度)。输出保存为 `video_trimmed.mp4`。

Individual skills in this repo

This repo contains 19 individual skills — each has its own dedicated page.

sundial-org/awesome-openclaw-skills

Complete X (Twitter) algorithm mastery - engagement weights, viral formulas, shadow ban avoidance, thread optimization, and growth strategies. Based on X's open-source code analysis and real creator data.

sundial-org/awesome-openclaw-skills

Create product demo videos by automating browser interactions and capturing frames. Use when the user wants to record a demo, walkthrough, product showcase, or interactive video of a web application. Supports Playwright CDP screencast for high-quality capture and FFmpeg for video encoding.

sundial-org/awesome-openclaw-skills

Text-to-speech conversion using node-edge-tts npm package for generating audio from text. Supports multiple voices, languages, speed adjustment, pitch control, and subtitle generation. Use when: (1) User requests audio/voice output with the "tts" trigger or keyword. (2) Content needs to be spoken rather than read (multitasking, accessibility, driving, cooking). (3) User wants a specific voice, speed, pitch, or format for TTS output.

sundial-org/awesome-openclaw-skills

Local speech-to-text using faster-whisper. 4-6x faster than OpenAI Whisper with identical accuracy; GPU acceleration enables ~20x realtime transcription. Supports standard and distilled models with word-level timestamps.

sundial-org/awesome-openclaw-skills

Comprehensive video/audio processing with FFmpeg. Use for: (1) Video transcoding and format conversion, (2) Cutting and merging clips, (3) Audio extraction and manipulation, (4) Thumbnail and GIF generation, (5) Resolution scaling and quality adjustment, (6) Adding subtitles or watermarks, (7) Speed adjustment (slow/fast motion), (8) Color correction and filters.

sundial-org/awesome-openclaw-skills

Create a verbatim transcript for a YouTube URL using Google Gemini (speaker labels, paragraph breaks; no time codes). Use when the user asks to transcribe a YouTube video or wants a clean transcript (no timestamps).

sundial-org/awesome-openclaw-skills

Generate landing page code from product descriptions

sundial-org/awesome-openclaw-skills

Generate a beautiful HTML landing page from your package.json. Use when you need a quick marketing page for your project.

sundial-org/awesome-openclaw-skills

Founder vs employee personal branding strategies with LinkedIn positioning and exit planning

sundial-org/awesome-openclaw-skills

Monitor stock/crypto holdings, get price alerts, track portfolio performance

sundial-org/awesome-openclaw-skills

End-to-end AI video generation - create videos from text prompts using image generation, video synthesis, voice-over, and editing. Supports OpenAI DALL-E, Replicate models, LumaAI, Runway, and FFmpeg editing.

sundial-org/exa-web-search-free

Free AI search via Exa MCP. Web search for news/info, code search for docs/examples from GitHub/StackOverflow, company research for business intel. No API key needed.

sundial-org/finance-news

Market news briefings with AI summaries. Use when asked about stock news, market updates, portfolio performance, morning/evening briefings, financial headlines, or price alerts. Supports US/Europe/Japan markets, WhatsApp delivery, and English/German output.

sundial-org/jina-reader

Web content extraction via Jina AI Reader API. Three modes: read (URL to markdown), search (web search + full content), ground (fact-checking). Extracts clean content without exposing server IP.

sundial-org/memory-setup

Enable and configure Moltbot/Clawdbot memory search for persistent context. Use when setting up memory, fixing "goldfish brain," or helping users configure memorySearch in their config. Covers MEMORY.md, daily logs, and vector search setup.

sundial-org/news-summary

This skill should be used when the user asks for news updates, daily briefings, or what's happening in the world. Fetches news from trusted international RSS feeds and can create voice summaries.

sundial-org/ontology

Typed knowledge graph for structured agent memory and composable skills. Use when creating/querying entities (Person, Project, Task, Event, Document), linking related objects, enforcing constraints, planning multi-step actions as graph transformations, or when skills need to share state. Trigger on "remember", "what do I know about", "link X to Y", "show dependencies", entity CRUD, or cross-skill data access.

sundial-org/remind-me

Set reminders using natural language. Automatically creates one-time cron jobs and logs to markdown.

sundial-org/stock-market-pro

Professional stock price tracking, fundamental analysis, and financial reporting tool. Supports global markets (US, KR, etc.), Crypto, and Forex with real-time data. (1) Real-time quotes, (2) Valuation metrics (PE, EPS, ROE), (3) Earnings calendar and consensus, (4) High-quality Candlestick & Line charts with technical indicators (MA5/20/60).

相关技能