Crates.io | ffmpeg-frame-grabber |
lib.rs | ffmpeg-frame-grabber |
version | 0.1.0 |
source | src |
created_at | 2021-03-31 12:30:52.564755 |
updated_at | 2021-03-31 12:30:52.564755 |
description | Provides a frame iterator for videos by using ffmpeg. Decodes images using the image crate. |
homepage | |
repository | https://github.com/hediet/rust-ffmpeg-frame-grabber |
max_upload_size | |
id | 376127 |
size | 34,247 |
cargo add ffmpeg_frame_grabber
This library requires the ffmpeg
and ffprobe
commands to be installed and in path!
use ffmpeg_frame_grabber::{FFMpegVideo, FFMpegVideoOptions};
use image_visualizer::{visualizer::view, VisualizableImage};
use std::{path::Path, time::Duration};
fn main()s {
let video = FFMpegVideo::open(
Path::new(&"./data/video.mp4"),
FFMpegVideoOptions::default().with_sampling_interval(Duration::from_secs(120)),
)
.unwrap();
for frame in video {
let f = frame.unwrap();
println!("offset: {:?}", f.time_offset);
view!(&f.image.visualize());
}
}