From rust-ffmpeg
Guides selection, implementation, review, and migration of Rust FFmpeg libraries (ez-ffmpeg, ffmpeg-next) for video/audio processing, media conversion, and multimedia tasks.
npx claudepluginhub yeautyye/skill-rust-ffmpeg --plugin rust-ffmpegThis skill uses the workspace's default tool permissions.
Guide for implementing FFmpeg functionality in Rust: library selection, code generation, and problem solving.
artifacts/analysis-report.mdreferences/_keywords_standard.mdreferences/ez_ffmpeg.mdreferences/ez_ffmpeg/advanced.mdreferences/ez_ffmpeg/audio.mdreferences/ez_ffmpeg/capture.mdreferences/ez_ffmpeg/cli_migration.mdreferences/ez_ffmpeg/filters.mdreferences/ez_ffmpeg/query.mdreferences/ez_ffmpeg/streaming.mdreferences/ez_ffmpeg/video.mdreferences/ffmpeg_next.mdreferences/ffmpeg_next/audio.mdreferences/ffmpeg_next/ffi.mdreferences/ffmpeg_next/filters.mdreferences/ffmpeg_next/metadata.mdreferences/ffmpeg_next/output.mdreferences/ffmpeg_next/streaming.mdreferences/ffmpeg_next/transcoding.mdreferences/ffmpeg_next/video.mdGuides FFmpeg use with Python libraries like ffmpeg-python, PyAV, moviepy for video/audio processing, encoding, streaming. Fixes common issues like audio loss, deadlocks, overwrites.
Provides FFmpeg 7.1 LTS/8.0.1 fundamentals: command syntax, codec selection (H.264/AV1/VP9), CRF/bitrate quality, filter chains, trimming/splitting/concat, ffprobe, Whisper transcription. For basic transcoding and format conversion.
FFmpeg CLI reference for video/audio processing: format conversion, resizing/cropping/trimming, audio mixing/extraction, overlays/text/subtitles, GIFs/thumbnails, GPU encoding, ffprobe inspection.
Share bugs, ideas, or general feedback.
Guide for implementing FFmpeg functionality in Rust: library selection, code generation, and problem solving.
| Library | Use When | Async | Safety | Trade-off |
|---|---|---|---|---|
| ez-ffmpeg | General tasks, CLI migration, RTMP server, custom Rust filters, custom I/O | ✅ Yes | Safe | Requires FFmpeg libs |
| ffmpeg-next | Frame-level control, codec internals, custom I/O (via FFI) | ❌ No | Safe | More boilerplate |
| ffmpeg-sys-next | Zero-copy, custom memory I/O, max performance | ❌ No | Unsafe | Manual memory mgmt |
| ffmpeg-sidecar | No FFmpeg installation possible | ❌ No | Safe | Process overhead, no custom I/O |
Default: Library Integration (ez-ffmpeg/ffmpeg-next/ffmpeg-sys-next)
Alternative: Binary Approach (ffmpeg-sidecar) - consider when:
If installation constrained → Load ffmpeg_sidecar.md
| User Mentions | Load Reference |
|---|---|
| "convert format", "remux", "trim", "resize", "crop", "simple" | video_transcoding.md |
| "extract audio", "audio only", "audio track", "mp3 extract", "loudnorm", "normalize audio", "volume" | audio_extraction.md |
| "thumbnail", "first frame", "multi-output", "concat", "watermark", "pipeline", "filter graph" | transcoding.md |
| "real-time", "RTMP", "HLS", "live", "stream", "capture", "webcam", "buffer", "backpressure", "jitter buffer", "network jitter" | streaming_rtmp_hls.md |
| "GPU", "NVENC", "VideoToolbox", "hardware", "VAAPI", "QSV" | hardware_acceleration.md |
| "batch", "multiple files", "bulk", "parallel" | batch_processing.md |
| "subtitles", "srt", "captions", "burn subs" | subtitles.md |
| "AV1", "AVIF", "HDR", "10-bit", "modern codec" | modern_codecs.md |
| "debug", "ffprobe", "inspect", "metadata", "error", "troubleshoot", "probe", "duration", "resolution", "corrupt", "integrity" | debugging.md |
| "filter", "effect", "scale", "crop", "overlay", "watermark", "blur", "sharpen", "color", "brightness", "rotate", "flip", "fade", "speed", "slow motion" | filters_effects.md |
| "image sequence", "frame extraction", "video to images", "images to video", "timelapse", "frame by frame" | image_sequences.md |
| "test", "validate", "verify", "golden file", "checksum", "generate test video", "testsrc" | testing.md |
| "web server", "API", "S3", "async job", "integration", "tracing", "logging", "log callback", "av_log", "log redirect" | integration.md |
| "gif", "animated gif", "video to gif", "gif from video", "gif loop", "gif palette" | gif_creation.md |
| "metadata", "chapter", "tag", "media info", "title", "artist", "album", "chapter marker" | metadata_chapters.md |
| "screen capture", "webcam", "camera capture", "record screen", "avfoundation", "directshow", "v4l2", "device capture" | capture.md |
| "AVPacket", "AVFrame", "keyframe", "GOP", "NALU", "bitstream", "EAGAIN", "decode loop", "memory", "packet" | ffmpeg_next.md + ffmpeg_sys_next.md |
| "custom io", "io context", "AVIOContext", "read callback", "write callback" | custom_io.md |
| "which library", "compare", "vs", "migrate to", "port to", "convert to", "switch from", "rewrite using", "feasibility", "should I use", "best library", "evaluate", "review FFmpeg code", "can this work with" | library_selection.md |
CLI Migration: Both ez-ffmpeg and ffmpeg-sidecar support CLI-style APIs. Choose based on constraints below.
- ez-ffmpeg: CLI Migration Guide — library integration, native performance
- ffmpeg-sidecar: CLI to Rust Migration — process wrapper, no FFmpeg libs needed
Note: FrameFilter (custom Rust frame processing) is separate from custom I/O callbacks (custom data sources/sinks). ez-ffmpeg supports both.
New to Rust FFmpeg? See quick_start.md for 5-minute setup.
| Library | Version | FFmpeg | Rust MSRV |
|---|---|---|---|
| ez-ffmpeg | 0.10.0 | 7.x | 1.70+ |
| ffmpeg-next | 7.1.0 | 7.x | 1.63+ |
| ffmpeg-sys-next | 7.1.0 | 7.x | 1.63+ |
| ffmpeg-sidecar | 2.4.0 | Any | 1.70+ |
Source: crates.io
Why not 8.x (ffmpeg-next / ffmpeg-sys-next)? Upstream rust-ffmpeg issue #246 reports a compilation error with FFmpeg 8.0 due to missing EXIF side data types (AV_FRAME_DATA_EXIF, AV_PKT_DATA_EXIF). We pin to 7.1.0 until it is resolved.
Installation Issues: installation.md
When this skill activates, follow this workflow:
For implementation tasks:
Result<> return types, no unwrap() in library codeFor evaluation/migration/selection tasks:
library_selection.md and relevant scenario referencesRules:
Cargo.toml dependencies when introducing a new libraryUser: "Write a Rust function to extract audio from MP4"
Claude: Identify → audio extraction → apply Layer 3 (general task, no special requirements) → load audio_extraction.md → generate function with proper error handling → include Cargo.toml dep
User: "I need frame-level access to decode H.264 and apply custom processing"
Claude: Identify → frame-level + custom processing → ez-ffmpeg FrameFilter (safe, simple) or ffmpeg-next (codec internals) → ask user preference if unclear → load ffmpeg_next.md or ez_ffmpeg/filters.md → generate decode loop with proper EAGAIN handling
User: "How to do RTMP live streaming in Rust?"
Claude: Identify → streaming + real-time → ez-ffmpeg (async + RTMP server) → load streaming_rtmp_hls.md → generate RTMP push/server example → mention jitter buffer for production use
User: "Can this video trimming code be converted to ez-ffmpeg? Fall back to ffmpeg-next if not"
Claude: Identify → library migration feasibility → load library_selection.md + video_transcoding.md → review existing code against ez-ffmpeg API → assess feasibility → provide migration path or explain why ffmpeg-next is needed
User: "Which Rust FFmpeg library should I use for my project?"
Claude: Identify → library selection → load library_selection.md → ask about requirements (async? frame-level? install constraints?) → apply Layer 3 decision logic → recommend with rationale
-c copy / stream copy when no re-encoding is needed — 10x faster, zero quality lossforce_key_frames for HLS/DASH segmentation to avoid playback glitchesResult<T, Box<dyn Error>>, never panic in library codeFfmpegContext/Decoder/Encoder drop automaticallytestsrc / sine filters to generate synthetic test media instead of shipping binary fixtures