本文へスキップ
Skillpedia
動画編集7.8k · #12885

ffmpeg-encoder-check-4855c0

できること

このスキルは、動画をエンコードする前に、AIにFFmpegの利用可能なエンコーダーを確認させます。コーデックやライブラリのエラーを見たことがある動画処理の人向けです。

使う場面

  • ✓FFmpegでH.264に動画をエンコードするスクリプトを書こうとしているとき。
  • ✓エンコーダーが不足しているか互換性がないため、FFmpegのエンコードが失敗したとき。
  • ✓元の動画を再エンコードせずにコピーできるとき。

スキルのリンク

https://github.com/HKUDS/AgentPilot/blob/main/openspace/benchmarks/gdpval/skills/ffmpeg-encoder-check-4855c0/SKILL.md

コピーしてAI(Claude、ChatGPT、Cursor)に貼り付け、指示に従うよう頼んでください。

使い方

いちばん簡単な方法:メッセージをコピーしてAIに貼り付けるだけ。AIがスキルを読んで指示に従います。

貼り付け用メッセージ

このスキルを使って手伝ってください:https://github.com/HKUDS/AgentPilot/blob/main/openspace/benchmarks/gdpval/skills/ffmpeg-encoder-check-4855c0/SKILL.md このリンクのSKILL.mdファイルを読んで、私の作業でその指示に従ってください。
こういうスキルを、AIが自分で見つけてくれたら?無料のSkillpedia MCPをインストール。1行で、作業の前に15,000+のスキルから探してくれます。1分でインストール →

AIへの頼み方の例

“この動画をFFmpegでH.264にエンコードしてください。まず、このパソコンにあるエンコーダーを確認して、動くものを選んでください。”

毎週5つの新しいスキル。1分で読めます。

仕組み

AIは、利用可能なH.264のエンコーダーを一覧にし、形式が既に合う場合は単純なストリームコピーを優先し、ある場合はlibx264を使い、本番の処理の前に短いクリップでテストします。

技術的な内容(元のSKILL.md)

作者による元のテキスト(英語)をGitHubからそのまま表示しています。

FFmpeg Encoder Availability Check

Purpose

Before writing any FFmpeg encoding script, always probe the system for available encoders. This prevents failures from missing or incompatible codec libraries (especially libopenh264 which frequently has version mismatches).

Core Pattern

Step 1: Probe Available Encoders

Always run this command before deciding on encoding parameters:

ffmpeg -encoders | grep h264

This shows which H.264 encoders are available on the system.

Step 2: Choose Encoder Based on Availability

Priority order for H.264 encoding:

  1. -c:v copy - If source and target resolution/format match, copy the stream without re-encoding (fastest, no quality loss)

  2. -c:v libx264 - If available, this is the most reliable and widely-compatible H.264 encoder

  3. -c:v h264 - Hardware acceleration if available (varies by system)

  4. Avoid libopenh264 - This encoder frequently has library version mismatches causing runtime failures

Step 3: Verify Before Execution

After choosing an encoder, verify it works with a short test:

ffmpeg -t 5 -i input.mp4 -c:v libx264 -preset fast -crf 23 -c:a copy test_output.mp4

Example Decision Flow

#!/bin/bash

# Check available encoders
ENCODERS=$(ffmpeg -encoders 2>/dev/null | grep h264)

if echo "$ENCODERS" | grep -q "libx264"; then
    VIDEO_CODEC="libx264"
    echo "Using libx264 encoder"
elif echo "$ENCODERS" | grep -q "h264"; then
    VIDEO_CODEC="h264"
    echo "Using h264 encoder"
else
    VIDEO_CODEC="copy"
    echo "No H.264 encoder available, using stream copy"
fi

# Use $VIDEO_CODEC in your ffmpeg command
ffmpeg -i input.mp4 -c:v $VIDEO_CODEC output.mp4

When to Use Stream Copy

Use -c:v copy when:

  • Source and target resolution are identical
  • Source codec is already H.264
  • You only need to change container format or audio
  • Speed is critical and re-encoding is unnecessary

Common Pitfalls

  • Don't assume encoder availability - Different systems have different FFmpeg builds
  • Don't hardcode libopenh264 - High failure rate due to library mismatches
  • Always test encoding - Run a short segment test before processing full files
  • Check both video and audio codecs - Audio encoder availability matters too
よくある質問

どのエンコーダーが優先されますか?

ガイドは、まずストリームコピー、次にlibx264を優先し、libopenh264は避けるよう述べています。

なぜ短いクリップでテストするのですか?

5秒のテストで、動画全体を処理する前にエンコーダーが動くかが分かるからです。

ストリームコピーとは何ですか?

動画を再エンコードせずにコピーすることで、画質の劣化がありません。

詳細

作者による元の説明

Check available FFmpeg encoders before writing encoding scripts to avoid library version mismatches

repo: HKUDS/AgentPilot

人気

GitHubのスター
7.8k
ランキング
#12885
ライセンス
MIT
更新日
2026/11/1

このスキルは役に立ちますか?

0

ログイン して投票しましょう。

コメント

  • …

このリポジトリの他のスキル

似ているスキル