‹ 首页

ffmpeg-encoder-check-4855c0

@hkuds · 收录于 5 天前 · 上游提交 1 周前

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

适合你,如果写 FFmpeg 脚本前总遇到编码器不兼容问题

/ 通过 npx 安装 校验哈希
npx oh-my-skill add hkuds/openspace/ffmpeg-encoder-check-4855c0
/ 通过 bash 安装
curl -fsSL https://oh-my-skill.com/install.sh | bash -s -- hkuds/openspace/ffmpeg-encoder-check-4855c0
/ 已经装过?验证本机副本,不用重装
npx oh-my-skill verify hkuds/openspace/ffmpeg-encoder-check-4855c0
安装目标可用 --agent / --scope 或 --to 明确指定;省略时只会在唯一已存在的 agent 目录上自动选择,零命中或多命中会停止并提示。content_hash 缺失或不一致均拒装。
6920GitHub stars
~532上下文体积 · 单文件
索引托管

怎么用

商店整理自技能原文 · 版本 2c5cc40 · 表述以原文为准
它做什么

装上后,Claude 在编写 FFmpeg 视频编码命令前,会先检查系统可用的 H.264 编码器,根据结果推荐使用 libx264、h264 或直接复制视频流,并建议先短测试确认。

什么时候触发

当你想用 FFmpeg 转换或编码视频时,Claude 会在给出命令前检查编码器可用性。

装好后可以这样说
Claude会检查后给出命令
Claude会解释版本问题并推荐替代
Claude可能判断使用流复制
技能原文 SKILL.md作者撰写 · MIT · 2c5cc40

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)
  1. -c:v libx264 - If available, this is the most reliable and widely-compatible H.264 encoder
  1. -c:v h264 - Hardware acceleration if available (varies by system)
  1. 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
按 MIT 许可原样转载,未经改动 · 在 GitHub 查看 →

评论

登录即可评论;带「已验证安装」的,是发布者名下有本店的安装或持有记录。