Chuyển đến nội dung
Skillpedia
Dựng video7.8k · #12885

ffmpeg-encoder-check-4855c0

Skill này làm gì

Skill này bảo AI kiểm tra các encoder có sẵn của FFmpeg trước khi mã hóa video. Dành cho người xử lý video đã gặp lỗi codec hoặc lỗi thư viện.

Khi nào nên dùng

  • ✓Khi tôi sắp viết một script FFmpeg để mã hóa video sang H.264.
  • ✓Khi việc mã hóa FFmpeg thất bại vì encoder bị thiếu hoặc không tương thích.
  • ✓Khi video nguồn có thể được sao chép mà không cần mã hóa lại.

Liên kết skill

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

Sao chép rồi dán vào AI của bạn (Claude, ChatGPT hoặc Cursor) và nhờ nó làm theo hướng dẫn.

Cách dùng

Cách dễ nhất: sao chép tin nhắn và dán vào AI của bạn. AI sẽ đọc skill và làm theo hướng dẫn.

Tin nhắn có sẵn để dán

Hãy dùng skill này để giúp tôi: https://github.com/HKUDS/AgentPilot/blob/main/openspace/benchmarks/gdpval/skills/ffmpeg-encoder-check-4855c0/SKILL.md Đọc tệp SKILL.md tại liên kết đó và làm theo hướng dẫn cho việc của tôi.
Bạn muốn AI tự tìm những skill như thế này?Cài MCP Skillpedia miễn phí: chỉ một dòng, và AI sẽ tìm trong 15.000+ skill trước mỗi việc.Cài đặt trong 1 phút →

Ví dụ cách nhờ AI

“Hãy mã hóa video này sang H.264 bằng FFmpeg. Trước tiên kiểm tra máy tính này có những encoder nào, rồi chọn một cái chạy được.”

5 skill mới mỗi tuần. Đọc chỉ 1 phút.

Cách hoạt động

AI liệt kê các encoder H.264, ưu tiên sao chép luồng đơn giản khi định dạng đã phù hợp, dùng libx264 khi có sẵn, và thử một clip ngắn trước khi chạy toàn bộ.

Nội dung kỹ thuật (SKILL.md gốc)

Lấy nguyên văn từ GitHub, do tác giả viết bằng tiếng Anh.

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
Câu hỏi thường gặp

Encoder nào được ưu tiên?

Hướng dẫn ưu tiên sao chép luồng trước, rồi đến libx264, và nói nên tránh libopenh264.

Vì sao thử trên clip ngắn?

Bài thử năm giây cho thấy encoder có hoạt động không trước khi xử lý toàn bộ video.

Sao chép luồng là gì?

Đó là sao chép video mà không mã hóa lại, nên không mất chất lượng.

Chi tiết

Mô tả gốc của tác giả

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

repo: HKUDS/AgentPilot

Độ phổ biến

Sao GitHub
7.8k
Vị trí xếp hạng
#12885
Giấy phép
MIT
Cập nhật
1/11/2026

Skill này có hữu ích không?

0

Đăng nhập để bình chọn.

Bình luận

  • …

Thêm skill từ kho mã này

Skill tương tự