pub struct VideoClip {
pub frames: Vec<VideoFrame>,
pub params: CodecParameters,
pub time_base: Option<TimeBase>,
}Expand description
Decoded video: frames in presentation order, the stream parameters describing them and the
time base of their pts. Frames are sampled as the model’s video processor does (see
crate::video::VideoOptions); the prompt timestamps of the sampled frames come from their
pts when every frame has one and time_base is set, otherwise from their index and the
frame rate. The frame rate is params.frame_rate, else the one the pts imply, else
DEFAULT_FPS.
Fields§
§frames: Vec<VideoFrame>§params: CodecParameters§time_base: Option<TimeBase>Implementations§
Source§impl VideoClip
impl VideoClip
pub fn new( frames: Vec<VideoFrame>, params: CodecParameters, time_base: Option<TimeBase>, ) -> Self
Sourcepub fn from_rgb(
width: usize,
height: usize,
fps: f64,
frames: Vec<Vec<u8>>,
) -> Result<Self>
pub fn from_rgb( width: usize, height: usize, fps: f64, frames: Vec<Vec<u8>>, ) -> Result<Self>
RGB frames at a constant fps (each width * height * 3 bytes), timed by index.
Sourcepub fn pts_seconds(&self) -> Option<Vec<f64>>
pub fn pts_seconds(&self) -> Option<Vec<f64>>
Presentation time of each frame in seconds from the first one, when every frame has a
pts and the time base is known.
Sourcepub fn fps(&self) -> f64
pub fn fps(&self) -> f64
The frame rate: params.frame_rate, else what the timestamps imply, else DEFAULT_FPS.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for VideoClip
impl RefUnwindSafe for VideoClip
impl Send for VideoClip
impl Sync for VideoClip
impl Unpin for VideoClip
impl UnsafeUnpin for VideoClip
impl UnwindSafe for VideoClip
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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> ⓘ
Converts
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> ⓘ
Converts
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 more