pub struct SpriteSheet { /* private fields */ }Expand description
Generates a thumbnail sprite sheet from a video file.
Frames are sampled at evenly-spaced intervals across the full video
duration and tiled into a single PNG image of size
cols × frame_width × rows × frame_height.
§Examples
ⓘ
use ff_encode::SpriteSheet;
SpriteSheet::new("video.mp4")
.cols(5)
.rows(4)
.frame_width(160)
.frame_height(90)
.output("sprites.png")
.run()?;Implementations§
Source§impl SpriteSheet
impl SpriteSheet
Sourcepub fn new(input: impl AsRef<Path>) -> Self
pub fn new(input: impl AsRef<Path>) -> Self
Creates a new SpriteSheet for the given input file.
Defaults: cols=10, rows=10, frame_width=160, frame_height=90,
no output path set.
Sourcepub fn frame_width(self, w: u32) -> Self
pub fn frame_width(self, w: u32) -> Self
Sets the width of each individual thumbnail frame in pixels (default: 160).
Sourcepub fn frame_height(self, h: u32) -> Self
pub fn frame_height(self, h: u32) -> Self
Sets the height of each individual thumbnail frame in pixels (default: 90).
Sourcepub fn output(self, path: impl AsRef<Path>) -> Self
pub fn output(self, path: impl AsRef<Path>) -> Self
Sets the output path for the generated PNG file.
Sourcepub fn run(self) -> Result<(), EncodeError>
pub fn run(self) -> Result<(), EncodeError>
Runs the sprite sheet generation.
Output image dimensions: cols × frame_width × rows × frame_height.
§Errors
EncodeError::MediaOperationFailed—colsorrowsis zero,frame_widthorframe_heightis zero, oroutputpath is not set.EncodeError::Ffmpeg— any FFmpeg filter graph or encoding call fails.
Auto Trait Implementations§
impl Freeze for SpriteSheet
impl RefUnwindSafe for SpriteSheet
impl Send for SpriteSheet
impl Sync for SpriteSheet
impl Unpin for SpriteSheet
impl UnsafeUnpin for SpriteSheet
impl UnwindSafe for SpriteSheet
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more