Communitygithub.com

Aseel1600/Edit01

FFmpegを使用した動画・音声処理スキル。フォーマット変換、リサイズ、圧縮、音声抽出、Remotionアセットの準備などに対応。GIFからMP4への変換、動画リサイズ、音声抽出、ファイル圧縮など、あらゆるメディア変換タスクをトリガーとします。

Edit01 とは?

このスキルは、動画・音声処理のための業界標準ツールFFmpegを活用し、特にRemotionビデオプロジェクト向けに最適化された操作手順を包括的に提供します。GIFからMP4への変換、動画リサイズ、圧縮、音声抽出、トリミング、速度変更など、基本的なメディア変換から、Remotion固有のパターン(動画速度調整、デモ録画の前処理)までを網羅。また、YouTube、Twitter/X、LinkedIn、Web埋め込みなど、各プラットフォーム向けの出力最適化(解像度、コーデック、ビットレート、ファイルサイズ制限に応じた設定)も詳細に解説しています。CRF値やプリセットによる品質ガイドライン、よくあるエラーの対処法も含んでおり、初心者から上級者まで映像制作ワークフローを効率化します。

対応✓Claude Code~Codex CLI~Cursor
npx skills add https://github.com/Aseel1600/Edit01/tree/HEAD/.agents/skills/ffmpeg

お気に入りのAIに質問する

このエージェントスキルを事前に読み込んだ状態で新しいチャットを開きます。

ドキュメント

動画制作のためのFFmpeg

FFmpegは動画/音声処理に必須のツールです。このスキルでは、Remotionビデオプロジェクトでよく使われる操作をカバーします。

クイックリファレンス

GIFをMP4に変換(Remotion互換)

ffmpeg -i input.gif -movflags faststart -pix_fmt yuv420p \
  -vf "scale=trunc(iw/2)*2:trunc(ih/2)*2" output.mp4

これらのフラグの理由:

  • -movflags faststart - メタデータを先頭に移動し、Webストリーミングに対応
  • -pix_fmt yuv420p - ほとんどのプレイヤーとの互換性を確保
  • scale=trunc(...) - 偶数サイズに強制(ほとんどのコーデックで必須)

動画のリサイズ

# 1920x1080に(アスペクト比維持、黒帯追加)
ffmpeg -i input.mp4 -vf "scale=1920:1080:force_original_aspect_ratio=decrease,pad=1920:1080:(ow-iw)/2:(oh-ih)/2" output.mp4

# 1920x1080に(トリミングしてフィル)
ffmpeg -i input.mp4 -vf "scale=1920:1080:force_original_aspect_ratio=increase,crop=1920:1080" output.mp4

# 幅指定、高さ自動
ffmpeg -i input.mp4 -vf "scale=1280:-2" output.mp4

動画の圧縮

# 高品質、小さいファイル(CRF 23がデフォルト、低いほど高品質)
ffmpeg -i input.mp4 -c:v libx264 -crf 23 -preset medium -c:a aac -b:a 128k output.mp4

# Webプレビュー用の強力な圧縮
ffmpeg -i input.mp4 -c:v libx264 -crf 28 -preset fast -c:a aac -b:a 96k output.mp4

# 目標ファイルサイズ(例: 60秒動画で約10MB = 約1.3Mbps)
ffmpeg -i input.mp4 -c:v libx264 -b:v 1300k -c:a aac -b:a 128k output.mp4

音声の抽出

# MP3に抽出
ffmpeg -i input.mp4 -vn -acodec libmp3lame -q:a 2 output.mp3

# AACに抽出
ffmpeg -i input.mp4 -vn -acodec aac -b:a 192k output.m4a

# WAVに抽出(非圧縮)
ffmpeg -i input.mp4 -vn output.wav

音声フォーマットの変換

# M4AからMP3(ElevenLabsの音声サンプル用)
ffmpeg -i input.m4a -codec:a libmp3lame -qscale:a 2 output.mp3

# WAVからMP3
ffmpeg -i input.wav -codec:a libmp3lame -b:a 192k output.mp3

# 音量調整
ffmpeg -i input.mp3 -filter:a "volume=1.5" output.mp3

動画のトリミング/カット

# タイムスタンプから再生時間分カット(推奨 - 信頼性が高い)
ffmpeg -i input.mp4 -ss 00:00:30 -t 00:00:15 -c:v libx264 -c:a aac output.mp4

# タイムスタンプからタイムスタンプまでカット
ffmpeg -i input.mp4 -ss 00:00:30 -to 00:00:45 -c:v libx264 -c:a aac output.mp4

# ストリームコピー(高速だがカットポイントでフレームが失われる可能性あり)
# ソースにキーフレームが多い場合のみ使用
ffmpeg -i input.mp4 -ss 00:00:30 -t 00:00:15 -c copy output.mp4

注意: トリミングには再エンコードを推奨します。ストリームコピー(-c copy)は、シークポイントがキーフレームと一致しない場合、黙ってビデオをドロップする可能性があります。

速度変更(早送り/スロー)

# 2倍速(動画と音声)
ffmpeg -i input.mp4 -filter_complex "[0:v]setpts=0.5*PTS[v];[0:a]atempo=2.0[a]" -map "[v]" -map "[a]" output.mp4

# 0.5倍速(スローモーション)
ffmpeg -i input.mp4 -filter_complex "[0:v]setpts=2.0*PTS[v];[0:a]atempo=0.5[a]" -map "[v]" -map "[a]" output.mp4

# 動画のみ(音声なし)
ffmpeg -i input.mp4 -filter:v "setpts=0.5*PTS" -an output.mp4

動画の連結

# ファイルリストを作成
echo "file 'clip1.mp4'" > list.txt
echo "file 'clip2.mp4'" >> list.txt
echo "file 'clip3.mp4'" >> list.txt

# 連結(同じコーデック/解像度)
ffmpeg -f concat -safe 0 -i list.txt -c copy output.mp4

# 再エンコードして連結(異なるソース)
ffmpeg -f concat -safe 0 -i list.txt -c:v libx264 -c:a aac output.mp4

フェードイン/アウトの追加

# 最初の1秒をフェードイン、最後の1秒をフェードアウト(30fps動画)
ffmpeg -i input.mp4 -vf "fade=t=in:st=0:d=1,fade=t=out:st=9:d=1" -c:a copy output.mp4

# 音声フェード
ffmpeg -i input.mp4 -af "afade=t=in:st=0:d=1,afade=t=out:st=9:d=1" -c:v copy output.mp4

動画情報の取得

# 再生時間、解像度、コーデック情報
ffprobe -v error -show_entries format=duration -of default=noprint_wrappers=1:nokey=1 input.mp4

# 完全な情報
ffprobe -v quiet -print_format json -show_format -show_streams input.mp4

Remotion固有のパターン

Remotionでの動画速度調整

FFmpegとRemotion playbackRate の使い分け:

シナリオFFmpegを使用Remotionを使用
一定速度(1.5倍、2倍)どちらでも可✅ より簡単
極端な速度(4倍超、0.25倍未満)✅ より信頼性が高い問題が発生する可能性あり
可変速度(時間経過で加速)✅ 事前処理複雑な代替手段が必要
完璧な音声同期が必要✅ 保証される通常は問題ない
デモをナレーションのタイミングに合わせる必要がある✅ 事前計算ランタイム調整

Remotionの制限: playbackRate は一定である必要があります。playbackRate={interpolate(frame, [0, 100], [1, 5])} のような動的な補間は、Remotionがフレームを独立して評価するため、正しく機能しません。

# シーンに合わせてデモを高速化(例: 60秒のデモを20秒に = 3倍速)
ffmpeg -i demo-raw.mp4 \
  -filter_complex "[0:v]setpts=0.333*PTS[v];[0:a]atempo=3.0[a]" \
  -map "[v]" -map "[a]" \
  public/demos/demo-fast.mp4

# 強調のためのスローモーション(0.5倍速)
ffmpeg -i action.mp4 \
  -filter_complex "[0:v]setpts=2.0*PTS[v];[0:a]atempo=0.5[a]" \
  -map "[v]" -map "[a]" \
  public/demos/action-slow.mp4

# 音声なしで高速化(画面録画で一般的)
ffmpeg -i demo.mp4 -filter:v "setpts=0.5*PTS" -an public/demos/demo-2x.mp4

# タイムラプス効果(10倍速、音声削除)
ffmpeg -i long-demo.mp4 -filter:v "setpts=0.1*PTS" -an public/demos/timelapse.mp4

倍率の計算:

  • X秒の動画をY秒のシーンに収める場合: 倍率 = X / Y
  • setpts乗数 = 1 / 倍率(例: 3倍速 = setpts=0.333*PTS)
  • atempo値 = 倍率(例: 3倍速 = atempo=3.0)

極端な速度(音声2倍超): atempoフィルタをチェーン(各フィルタは0.5~2.0の範囲に制限):

# 4倍速音声
-filter_complex "[0:a]atempo=2.0,atempo=2.0[a]"

# 8倍速音声
-filter_complex "[0:a]atempo=2.0,atempo=2.0,atempo=2.0[a]"

Remotion用のデモ録画の準備

# 標準1080p、30fps、Remotion対応
ffmpeg -i raw-recording.mp4 \
  -vf "scale=1920:1080:force_original_aspect_ratio=decrease,pad=1920:1080:(ow-iw)/2:(oh-ih)/2,fps=30" \
  -c:v libx264 -crf 18 -preset slow \
  -c:a aac -b:a 192k \
  -movflags faststart \
  public/demos/demo.mp4

画面録画からRemotionアセットへ

# iPhone/iPad録画から(通常60fps、可変解像度)
ffmpeg -i iphone-recording.mov \
  -vf "scale=1920:-2,fps=30" \
  -c:v libx264 -crf 20 \
  -an \
  public/demos/mobile-demo.mp4

GIFの一括変換

for f in assets/*.gif; do
  ffmpeg -i "$f" -movflags faststart -pix_fmt yuv420p \
    -vf "scale=trunc(iw/2)*2:trunc(ih/2)*2" \
    "public/demos/$(basename "$f" .gif).mp4"
done

よくある問題

「Height not divisible by 2」

スケールフィルタを追加: -vf "scale=trunc(iw/2)*2:trunc(ih/2)*2"

ブラウザで動画が再生されない

次を使用: -movflags faststart -pix_fmt yuv420p -c:v libx264

速度変更後に音声がずれる

filter_complexをatempoとともに使用: -filter_complex "[0:v]setpts=0.5*PTS[v];[0:a]atempo=2.0[a]"

ファイルサイズが大きすぎる

CRF値を上げる(23→28)または解像度を下げる

品質ガイドライン

使用目的CRFプリセット備考
アーカイブ/マスター18slow最高品質、大容量ファイル
プロダクション20-22medium良いバランス
Web/プレビュー23-25fast小さいファイル
ドラフト/クイック28+veryfast高速エンコード

プラットフォーム別出力最適化

Remotionが動画をレンダリングした後(通常 out/video.mp4)、FFmpegを使用して各配信プラットフォーム用に最適化します。

ワークフロー統合

Remotionレンダリング(マスター)     FFmpeg最適化      プラットフォームアップロード
       ↓                            ↓                       ↓
   out/video.mp4  ────────→  out/video-youtube.mp4  ───→  YouTube
                  ────────→  out/video-twitter.mp4  ───→  Twitter/X
                  ────────→  out/video-linkedin.mp4 ───→  LinkedIn
                  ────────→  out/video-web.mp4      ───→  Webサイト埋め込み

YouTube(推奨設定)

YouTubeはすべてを再エンコードするため、高品質でアップロード:

# YouTube最適化(1080p)
ffmpeg -i out/video.mp4 \
  -c:v libx264 -preset slow -crf 18 \
  -profile:v high -level 4.0 \
  -bf 2 -g 30 \
  -c:a aac -b:a 192k -ar 48000 \
  -movflags +faststart \
  out/video-youtube.mp4

# YouTube Shorts(縦型1080x1920)
ffmpeg -i out/video.mp4 \
  -vf "scale=1080:1920:force_original_aspect_ratio=decrease,pad=1080:1920:(ow-iw)/2:(oh-ih)/2" \
  -c:v libx264 -crf 18 -c:a aac -b:a 192k \
  out/video-shorts.mp4

Twitter/X

Twitterには厳しい制限があります: 最大140秒、512MB、1920x1200:

# Twitter最適化(高速アップロードのため15MB未満を目標)
ffmpeg -i out/video.mp4 \
  -c:v libx264 -preset medium -crf 24 \
  -profile:v main -level 3.1 \
  -vf "scale='min(1280,iw)':'min(720,ih)':force_original_aspect_ratio=decrease" \
  -c:a aac -b:a 128k -ar 44100 \
  -movflags +faststart \
  -fs 15M \
  out/video-twitter.mp4

# ファイルサイズと再生時間を確認
ffprobe -v error -show_entries format=duration,size -of csv=p=0 out/video-twitter.mp4

LinkedIn

LinkedInはAACオーディオ付きのMP4を推奨、最大10分:

# LinkedIn最適化
ffmpeg -i out/video.mp4 \
  -c:v libx264 -preset medium -crf 22 \
  -profile:v main \
  -vf "scale='min(1920,iw)':'min(1080,ih)':force_original_aspect_ratio=decrease" \
  -c:a aac -b:a 192k -ar 48000 \
  -movflags +faststart \
  out/video-linkedin.mp4

Webサイト/埋め込み(高速読み込みに最適化)

# Web最適化MP4(小さいファイル、プログレッシブ読み込み)
ffmpeg -i out/video.mp4 \
  -c:v libx264 -preset medium -crf 26 \
  -profile:v baseline -level 3.0 \
  -vf "scale=1280:720" \
  -c:a aac -b:a 128k \
  -movflags +faststart \
  out/video-web.mp4

# WebM代替(より良い圧縮、より広いブラウザ対応)
ffmpeg -i out/video.mp4 \
  -c:v libvpx-vp9 -crf 30 -b:v 0 \
  -vf "scale=1280:720" \
  -c:a libopus -b:a 128k \
  -deadline good \
  out/video-web.webm

GIF(プレビュー/サムネイル用)

# 高品質GIF(最初の5秒)
ffmpeg -i out/video.mp4 -t 5 \
  -vf "fps=15,scale=480:-1:flags=lanczos,split[s0][s1];[s0]palettegen[p];[s1][p]paletteuse" \
  out/preview.gif

# より小さいファイルのGIF
ffmpeg -i out/video.mp4 -t 3 \
  -vf "fps=10,scale=320:-1:flags=lanczos,split[s0][s1];[s0]palettegen[p];[s1][p]paletteuse" \
  out/preview-small.gif

プラットフォーム要件クイックリファレンス

プラットフォーム最大解像度最大サイズ最大再生時間音声
YouTube8K256GB12時間AAC 48kHz
Twitter/X1920x1200512MB140秒AAC 44.1kHz
LinkedIn4096x23045GB10分AAC 48kHz
Instagram フィード1080x13504GB60秒AAC 48kHz
Instagram Reels1080x19204GB90秒AAC 48kHz
TikTok1080x1920287MB10分AAC

全プラットフォームへの一括エクスポート

#!/bin/bash
# 保存先: export-all-platforms.sh
INPUT="out/video.mp4"

# YouTube(高品質)
ffmpeg -i "$INPUT" -c:v libx264 -preset slow -crf 18 \
  -c:a aac -b:a 192k -movflags +faststart \
  out/video-youtube.mp4

# Twitter(圧縮)
ffmpeg -i "$INPUT" -c:v libx264 -crf 24 \
  -vf "scale='min(1280,iw)':'-2'" \
  -c:a aac -b:a 128k -movflags +faststart \
  out/video-twitter.mp4

# LinkedIn
ffmpeg -i "$INPUT" -c:v libx264 -crf 22 \
  -c:a aac -b:a 192k -movflags +faststart \
  out/video-linkedin.mp4

# Web埋め込み(小さい)
ffmpeg -i "$INPUT" -c:v libx264 -crf 26 \
  -vf "scale=1280:720" \
  -c:a aac -b:a 128k -movflags +faststart \
  out/video-web.mp4

echo "エクスポート完了:"
ls -lh out/video-*.mp4

エラーハンドリング

動画処理時の一般的なエラーと修正方法:

# FFmpegが成功したか確認
ffmpeg -i input.mp4 -c:v libx264 output.mp4 && echo "成功" || echo "失敗: 入力ファイルを確認"

# 出力ファイルが再生可能か検証
ffprobe -v error -select_streams v:0 -show_entries stream=codec_name -of csv=p=0 output.mp4

# 詳細なエラー情報を取得
ffmpeg -v error -i input.mp4 -f null - 2>&1 | head -20

よくある失敗の対処

エラー原因修正
「No such file」入力パスが間違っているパスを確認、スペースがある場合は引用符を使用
「Invalid data」入力が破損しているソースを再ダウンロードまたは再録画
「height not divisible by 2」奇数サイズtrunc付きスケールフィルタを追加
「encoder not found」コーデックがないフルコーデックのFFmpegをインストール
出力が0バイトサイレント失敗FFmpegの全出力を確認

フィードバックとコントリビューション

このスキルに情報が不足していたり、改善できる点がある場合:

  • コマンドが足りない? 何が必要だったか教えてください
  • エラーを見つけた? 何が問題か教えてください
  • コントリビューションしたい? 以下のサポートが可能です:
    1. このスキルを改善点で更新
    2. github.com/digitalsamba/claude-code-video-toolkit にPRを作成

「このスキルを改善」と言うだけで、.claude/skills/ffmpeg/SKILL.md の更新をガイドします。

Individual skills in this repo

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

Aseel1600/Edit01

Generate AI videos from text prompts using multiple provider gateways. Use when: (1) Generating videos from text descriptions, (2) Creating AI-generated video clips for content production, (3) Image-to-video generation with a reference image, (4) Choosing between video generation providers (VEO, Kling, Sora, Runway, Seedance, MiniMax, Gemini Omni). Supports gateways: HeyGen API, fal.ai API, Kling official direct API, and the Gemini API (Gemini Omni Flash).

Aseel1600/Edit01

Create AI avatar videos with precise control over avatars, voices, scripts, scenes, and backgrounds using HeyGen's v2 API. Use when: (1) Choosing a specific avatar and voice for a video, (2) Writing exact scripts for an avatar to speak, (3) Building multi-scene videos with different backgrounds per scene, (4) Creating transparent WebM videos for compositing, (5) Using talking photos as video presenters, (6) Integrating HeyGen avatars with Remotion, (7) Batch video generation with exact specs, (8) Brand-consistent production videos with precise control.

Aseel1600/Edit01

Use p5.js/canvas for local procedural character effects: particles, weather, squash/stretch, walk cycles, and environmental motion.

Aseel1600/Edit01

Review local character animation with schema checks, Playwright browser previews, frame sampling, and FFmpeg/ffprobe final output checks.

Aseel1600/Edit01

Create videos from a text prompt using HeyGen's Video Agent. Use when: (1) Creating a video from a description or idea, (2) Generating explainer, demo, or marketing videos from a prompt, (3) Making a video without specifying exact avatars, voices, or scenes, (4) Quick video prototyping or drafts, (5) One-shot prompt-to-video generation, (6) User says "make me a video" or "create a video about X".

Aseel1600/Edit01

Generate Mandarin and multilingual narration with Volcengine Doubao Speech 2.0. Use when creating Chinese voiceovers, when the user prefers Doubao/Volcengine/火山引擎/豆包 TTS, or when narration needs character-level timestamp metadata for subtitles.

Aseel1600/Edit01

Generate expressive, multilingual narration with fish.audio (S1 / S2-generation models) and reuse cloned voices via reference_id. Use when the user prefers fish.audio/Fish Audio TTS, wants a specific playground voice model, or needs high-emotion voice-clone narration.

Aseel1600/Edit01

Use when implementing Disney's 12 animation principles with Framer Motion in React applications

Aseel1600/Edit01

All animation knowledge for HyperFrames — atomic motion rules, multi-phase scene blueprints, scene transitions, broader motion-design techniques, AND the seven runtime adapters (GSAP default, plus Lottie, Three.js, Anime.js, CSS keyframes, Web Animations API, TypeGPU). Use for any motion or animation task: pick 2-4 rules and compose, or load a blueprint, or look up runtime-specific API (e.g. GSAP eases / Lottie player / Three.js mixer). HyperFrames-native: single paused timeline, seek-safe, deterministic.

Aseel1600/Edit01

HyperFrames CLI dev loop. Use when running npx hyperframes init, add, catalog, capture, lint, validate, inspect, layout, snapshot, preview, play, render, publish, lambda, doctor, browser, info, upgrade, skills, compositions, docs, benchmark, telemetry, transcribe, tts, or remove-background, or when troubleshooting the HyperFrames build/render environment. Entry point for AWS Lambda cloud rendering (`hyperframes lambda deploy / render / progress / destroy / policies`).

Aseel1600/Edit01

The HyperFrames composition contract — build one renderable project. Use for composition structure, the `data-*` timing attributes, `class="clip"`, tracks, sub-compositions, variables, framework-owned media playback, deterministic-render rules, and validation. Read before writing composition HTML.

Aseel1600/Edit01

Non-animation creative direction for HyperFrames videos. Use for design spec (frame.md / design.md) handling, palettes, typography, narration, beat planning, audio-reactive visuals, composition patterns, and brand / style decisions. For atomic motion patterns and scene blueprints, use `hyperframes-animation`.

Aseel1600/Edit01

Audio and media assets for HyperFrames compositions, produced by one shared audio engine (`scripts/audio.mjs`) — multi-provider TTS (HeyGen / ElevenLabs / Kokoro local), background music + sound effects (HeyGen audio-library retrieval by default, with local Lyria / MusicGen BGM generation and a bundled SFX library as the no-credential fallback), Whisper transcription, background removal, and caption authoring. Use for voiceover / TTS, BGM, SFX / sound effects, transcription, captions / subtitles / lyrics / karaoke / per-word styling, voice + provider selection, and music-mood prompting.

Aseel1600/Edit01

Install and wire registry blocks and components into HyperFrames compositions. Use when running hyperframes add, installing a block or component, wiring an installed item into index.html, or working with hyperframes.json. Covers the add command, install locations, block sub-composition wiring, component snippet merging, registry discovery, and authoring a new block or component to contribute upstream (idea → scaffold → validate → PR).

Aseel1600/Edit01

Use when the user wants a short, design-led motion graphic where motion is the message: kinetic typography, stat or number count-up, chart/data-viz hit, logo sting, brand lockup, lower-third, callout, social overlay, animated headline/tweet/news item, motion poster, or quick captured-page highlight. Usually under 10s and up to ~30s, with no narration arc, voice-over, or live-action subject. Can render to MP4 or transparent overlay. Not for longer, multi-scene, narrated, or brand-reel pieces (use general-video), narrated website videos (website-to-video), topic explainers (faceless-explainer), product promos (product-launch-video), PR videos (pr-to-video), or captions on existing footage (embedded-captions). When unsure whether it's a quick motion-first piece or a longer / narrated treatment, see /hyperframes.

Aseel1600/Edit01

Use when the user has a music track (an audio file, or a video to pull audio from) and wants a beat-synced HyperFrames video, calm to hard-hitting. The music drives everything: one analyzer reads it once, the orchestrator lays out the frames and fills a per-frame plan, and one sub-agent builds each frame. Typography and templates are the floor — a complete video needs zero assets — but any images or videos the user supplies are cut into the frames on the same beat grid (beat-cut / ken-burns). The genre (lyric video, slideshow, kinetic promo) falls out of the per-frame choices; the pipeline never branches on it.

Aseel1600/Edit01

Best practices for Remotion - Video creation in React

Aseel1600/Edit01

Toolkit-specific Remotion patterns — custom transitions, shared components, and project conventions. For core Remotion framework knowledge (hooks, animations, rendering, etc.), see the `remotion-official` skill.

Aseel1600/Edit01

Port an existing Remotion (React) composition to HyperFrames HTML. Use ONLY when the user explicitly asks to port/convert/migrate/translate a Remotion source. Do NOT use: (a) authoring a new HyperFrames composition; (b) Remotion mentioned in passing; (c) Remotion code shared as reference only; (d) "same video as my Remotion one" without explicit migrate request — treat as fresh build. Doubt → `/general-video`. One-way, Remotion-only: no reverse export (HyperFrames→Remotion or any framework), no non-Remotion source (After Effects, Framer Motion, plain React/CSS) → out of scope, re-create via `/general-video`. Flags unsupported patterns (useState, useEffect, async calculateMetadata, third-party React libs, `@remotion/lambda`) and recommends runtime interop over lossy translation. Unsure whether to port vs. build fresh, or only a passing Remotion mention? → /hyperframes.

Aseel1600/Edit01

Animate SVG character rigs with GSAP, CSS transforms, Remotion frame control, and HyperFrames-compatible browser previews.

関連スキル