spacedrive/crates/ffmpeg
Vítor Vasconcellos 405fb023d8
Clean up and update rust dependencies (#2544)
* Clean up and update rust dependencies

* Attempt to fix Windows Error
2024-06-10 19:44:00 +00:00
..
src Improve Thumbnail quality + fixes (#2467) 2024-05-09 05:48:43 +00:00
.gitignore Added crates folder (#389) 2022-09-29 21:02:29 -07:00
Cargo.toml Clean up and update rust dependencies (#2544) 2024-06-10 19:44:00 +00:00
README.md Media metadata extraction & Thumbnailer rework (#2285) 2024-05-09 02:20:28 +00:00

FFmpeg Thumbnailer RS

Rust implementation of a thumbnail generation for video files using FFmpeg. Based on https://github.com/dirkvdb/ffmpegthumbnailer

For now only implements the minimum API for Spacedrive needs. PRs are welcome

Usage


use ffmpegthumbnailer_rs::{to_thumbnail, ThumbnailerError};

#[tokio::main]
async fn main() -> Result<(), ThumbnailerError> {
    to_thumbnail("input.mp4", "output.webp", 256, 100.0).await
}

Or you can use a builder to change the default options


use ffmpegthumbnailer_rs::{ThumbnailerBuilder, ThumbnailerError};

#[tokio::main]
async fn main() -> Result<(), ThumbnailerError> {
    let thumbnailer = ThumbnailerBuilder::new()
        .width_and_height(420, 315)
        .seek_percentage(0.25)?
        .quality(80.0)?
        .build();

    thumbnailer.process("input.mp4", "output.webp").await
}