media-decode
Multi-format media decoding for Rust: rasterize or decode files to pixels, probe metadata, extract PDF text, sample video frames, and generate thumbnail files.
Formerly published as auto-thumbnail (0.2.x). Use media-decode for new projects.
Installation
[]
= { = "0.3", = ["full"] }
Feature flags
| Feature | Enables |
|---|---|
image |
Raster images via enhanced decode path |
video |
FFmpeg video frame extraction + duration probe |
pdf |
pdfium render + per-page text extraction |
svg |
resvg vector rasterization |
raw |
rawler RAW develop (+ X3F embedded JPEG) |
audio |
lofty embedded cover art + duration probe |
office |
ZIP embedded thumbnail from OOXML/ODF |
source |
PSD/AI design source previews |
full |
All of the above (default) |
API overview
Thumbnails (write image file)
use Thumbnailer;
let thumbnailer = default;
thumbnailer.create_thumbnail?;
Decode to pixels (no file output)
Shared by thumbnails, similarity search, palette extraction, and previews:
use ;
let img = decode_image?;
let thumb = decode_and_thumbnail?;
let routed = decode_for_thumbnail?;
Media metadata (no full decode)
use probe_media_meta;
if let Some = probe_media_meta
PDF text and multi-page render
Video frame sampling
Blank-frame detection
use ;
Building
Video (feature = "video")
Requires FFmpeg 8.x dev libraries (ffmpeg-next 8.1). See cherry-box docs or vcpkg example in project wiki.
PDF (feature = "pdf")
Requires pdfium at runtime. See pdfium-render.
Migrating from auto-thumbnail
Replace dependency:
# before
= { = "0.2", = ["full"] }
# after
= { = "0.3", = ["full"] }
Replace imports: auto_thumbnail:: → media_decode::.
auto-thumbnail 0.3.0 on crates.io is a deprecated re-export shim only.