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

ffmpeg-encoder-check

できること

このスキルは、FFmpegのH.264エンコーダーを一覧にし、パソコンに最適なものを選ぶ方法を示します。動画をエンコードしてコーデックの問題を避けたい人向けです。

使う場面

  • ✓FFmpegで動画を変換またはエンコードする必要があるとき。
  • ✓ライブラリのバージョンの不一致で、動画の作業が失敗したとき。
  • ✓元の動画がすでに希望の形式に合っていて、再エンコードが不要なとき。

スキルのリンク

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

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

使い方

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

貼り付け用メッセージ

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

AIへの頼み方の例

“FFmpegで動画を変換してください。作業が失敗しないよう、まずインストールされているH.264のエンコーダーを確認してください。”

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

仕組み

AIは、システムにあるエンコーダーを一覧にし、一覧の選択肢と比べ、ストリームコピー、libx264、ハードウェアのエンコーダー、その他の利用可能なものから選びます。

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

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

FFmpeg Encoder Availability Check

Purpose

Before writing video encoding scripts, always verify which H.264 encoders are available in your FFmpeg installation. This prevents failures from library version mismatches, particularly with libopenh264.

Instructions

Step 1: Probe Available Encoders

Run the following command to check available H.264 encoders:

ffmpeg -encoders 2>/dev/null | grep h264

This shows which H.264 encoders are compiled into your FFmpeg build.

Step 2: Interpret Results

Common encoder options you may see:

Encoder Description Recommendation
libx264 Software H.264 encoder Preferred - widely compatible
libopenh264 OpenH264 software encoder Use with caution - often has library version mismatches
h264_nvenc NVIDIA hardware encoder Good if NVIDIA GPU available
h264_videotoolbox macOS hardware encoder Good on macOS
h264_vaapi Intel VAAPI hardware encoder Good on Linux with Intel GPU
h264_qsv Intel QuickSync encoder Good on Windows/Linux with Intel GPU

Step 3: Choose Encoding Strategy

For same-resolution sources (no re-encoding needed):

# Best option - pass-through without quality loss
ffmpeg -i input.mp4 -c:v copy -c:a copy output.mp4

If libx264 is available:

# Reliable software encoding
ffmpeg -i input.mp4 -c:v libx264 -preset medium -crf 23 -c:a aac output.mp4

If only libopenh264 is available:

# Use with caution - may have library issues
ffmpeg -i input.mp4 -c:v libopenh264 -c:a aac output.mp4

Step 4: Validate Before Batch Processing

Always test your encoding command on a small sample file before processing multiple videos or long footage.

Best Practices

  1. Default to -c:v copy when source and target resolutions match - no quality loss, fastest processing
  2. Prefer libx264 over libopenh264 for software encoding - more stable, better compatibility
  3. Check encoder availability at script startup, not during execution - fail fast with clear error
  4. Cache encoder check results if running multiple encoding operations in the same session
  5. Provide fallback options in automated scripts - try copy first, then libx264, then fail gracefully

Example Script Template

#!/bin/bash

# Check available encoders at startup
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 "libopenh264"; then
    VIDEO_CODEC="libopenh264"
    echo "Warning: Using libopenh264 (may have compatibility issues)"
else
    echo "Error: No H.264 encoder available"
    echo "Available encoders:"
    echo "$ENCODERS"
    exit 1
fi

# For same-resolution sources, prefer copy
if [ "$SOURCE_RESOLUTION" = "$TARGET_RESOLUTION" ]; then
    VIDEO_CODEC="copy"
    echo "Same resolution detected - using stream copy"
fi

# Encode
ffmpeg -i "$INPUT" -c:v "$VIDEO_CODEC" -c:a aac "$OUTPUT"

Common Errors to Avoid

  • Do not assume libx264 is available - FFmpeg builds vary by system
  • Do not use libopenh264 without checking - frequent library version mismatch errors
  • Do not re-encode unnecessarily - use -c:v copy when resolution matches
  • Do not skip the encoder check - always probe before writing encoding logic
よくある質問

最も互換性の高いエンコーダーは?

ガイドは、libx264が推奨され、広く互換性があると述べています。

ハードウェアのエンコーダーは何に依存しますか?

パソコンのグラフィックハードウェアに依存します。NVIDIA、Apple、Intelのチップなどです。

なぜlibopenh264を避けるのですか?

ライブラリのバージョンの不一致がよく起きるとガイドは述べています。

詳細

作者による元の説明

Check FFmpeg encoder availability before video encoding to avoid library mismatches

repo: HKUDS/AgentPilot

人気

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

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

0

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

コメント

  • …

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

似ているスキル