pub struct VideoInput {
pub frames: Vec<DynamicImage>,
pub fps: f64,
pub total_num_frames: usize,
pub sampled_indices: Vec<usize>,
}Expand description
Decoded video input: a sequence of frames with metadata for timestamp generation.
Create from pre-decoded frames with VideoInput::from_frames, or use the
server-core parse_video_url helper to decode from a video file (requires FFmpeg
for non-GIF formats).
Fields§
§frames: Vec<DynamicImage>Decoded video frames (RGB images).
fps: f64Frames per second of the original video. Used to compute per-frame
timestamps for the prompt (e.g. "00:05"). Defaults to 24.0.
total_num_frames: usizeTotal number of frames in the original video before sampling.
sampled_indices: Vec<usize>Indices of the frames that were sampled from the original video.
Length must equal frames.len().
Implementations§
Source§impl VideoInput
impl VideoInput
Sourcepub fn from_frames(
frames: Vec<DynamicImage>,
fps: f64,
sampled_indices: Option<Vec<usize>>,
) -> Self
pub fn from_frames( frames: Vec<DynamicImage>, fps: f64, sampled_indices: Option<Vec<usize>>, ) -> Self
Create a VideoInput from pre-decoded frames.
fps is the original video frame rate (used for timestamp generation).
If the frames were not sampled (i.e. all frames are provided), pass None
for sampled_indices and they will default to 0..frames.len().
Sourcepub fn timestamps_secs(&self) -> Vec<f64>
pub fn timestamps_secs(&self) -> Vec<f64>
Compute per-frame timestamps in seconds.
Sourcepub fn timestamp_strings(&self) -> Vec<String>
pub fn timestamp_strings(&self) -> Vec<String>
Format timestamps as "mm:ss" strings.
Sourcepub fn frame_hashes(&self) -> Vec<u64>
pub fn frame_hashes(&self) -> Vec<u64>
Compute a content hash for each frame (for prefix caching).
Sourcepub fn video_hash(&self) -> u64
pub fn video_hash(&self) -> u64
Compute a single hash representing the entire video (for prefix caching).
Trait Implementations§
Source§impl Clone for VideoInput
impl Clone for VideoInput
Source§fn clone(&self) -> VideoInput
fn clone(&self) -> VideoInput
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for VideoInput
impl Debug for VideoInput
Source§impl PartialEq for VideoInput
impl PartialEq for VideoInput
impl StructuralPartialEq for VideoInput
Auto Trait Implementations§
impl Freeze for VideoInput
impl RefUnwindSafe for VideoInput
impl Send for VideoInput
impl Sync for VideoInput
impl Unpin for VideoInput
impl UnsafeUnpin for VideoInput
impl UnwindSafe for VideoInput
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for T
impl<T> Downcast for T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<F, T> IntoSample<T> for Fwhere
T: FromSample<F>,
impl<F, T> IntoSample<T> for Fwhere
T: FromSample<F>,
fn into_sample(self) -> T
Source§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.