Communitygithub.com

FFmpeg 影片編輯器

根據自然語言影片編輯需求(剪裁、修剪、轉換、壓縮、變更比例、擷取音訊等)產生 FFmpeg 指令。

FFmpeg 影片編輯器 是什麼?

這項技能專為將自然語言影片編輯請求轉換為精確的 FFmpeg 指令而設計。它涵蓋了常見的影片處理操作,包括剪裁/修剪、格式轉換、變更長寬比、調整解析度、壓縮、音訊擷取與移除、速度調整、GIF 轉換、旋轉/翻轉、截圖、添加浮水印、嵌入字幕以及合併多個影片。 使用者只需用簡單的中文描述需求,助理就會自動識別操作類型、提取參數(如輸入檔案、時間戳記、目標格式),並生成正確的 FFmpeg 指令。此外,技能還加入了最佳實務:自動包含 `-y` 覆蓋輸出與 `-hide_banner` 參數、在未指定輸出檔名時自動建立合理的檔名,以及為不同操作提供預設編碼器與選項。 這項技能適用於任何支援 AI 助理或 LLM 代理的平台上使用,例如終端機中的 Claude、VSCode 擴充功能,或自訂開發工具。文件採用標準的 Markdown 格式,並包含時間格式參考與清晰的命令回應範例,讓使用者能輕鬆複製貼上執行。

相容平台~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」、「做成正方形」、「直立給 TikTok」

常見長寬比:

比例解析度用途
16:91920x1080YouTube、電視
4:31440x1080舊電視格式
1:11080x1080Instagram 正方形
9:161080x1920TikTok、Reels、限時動態
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"
    
  • 直立給 TikTok:
    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 為平衡值。

使用者可能會說:「壓縮影片」、「減少檔案大小」、「讓檔案變小以便寄 email」

指令:

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.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"

範例 - 標誌在右上角:

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).

相關技能