ffmpeg-encoder-check-4855c0
它能做什么
这项技能告诉 AI 在编码视频之前,先检查 FFmpeg 可用的编码器。它适合处理视频、并遇到过编解码器或库错误的人。
适用场景
- ✓当我即将编写一个把视频编码为 H.264 的 FFmpeg 脚本的时候。
- ✓当 FFmpeg 编码因缺少编码器或编码器不兼容而失败的时候。
- ✓当源视频无需重新编码即可直接复制的时候。
技能链接
https://github.com/HKUDS/AgentPilot/blob/main/openspace/benchmarks/gdpval/skills/ffmpeg-encoder-check-4855c0/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 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:
-c:v copy- If source and target resolution/format match, copy the stream without re-encoding (fastest, no quality loss)-c:v libx264- If available, this is the most reliable and widely-compatible H.264 encoder-c:v h264- Hardware acceleration if available (varies by system)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。
为什么要用短片测试?
五秒钟的测试可以在处理完整视频之前,显示编码器是否可用。
什么是流复制?
它直接复制视频而不重新编码,因此没有画质损失。
详情
作者的原始描述
Check available FFmpeg encoders before writing encoding scripts to avoid library version mismatches
repo: HKUDS/AgentPilot
热度
- GitHub 星标
- 7.8k
- 排名
- #12885
- 许可证
- MIT
- 更新时间
- 2026/11/1
评论
- …
同一仓库的更多技能
agentpilot
7.8k帮你的智能体准备任务并运行 AgentPilot 循环,逐步改进项目:循环会提出修改、测试修改并为其打分。
openspace
7.8k帮你的智能体设置 OpenSpace,这是一个用于存储和获取智能体技能的工具,并通过 MCP 将其连接到你的 AI 应用。
rsi-arena
7.8k帮你的智能体设置并运行标准 AI 基准测试,例如 AIME 和 Terminal-Bench,用来比较不同的改进方法。
experiment-guide
7.8k帮你的智能体规划小型实验、阅读实验结果并记录发现,同时研究如何改进一个程序。