pub struct VideoEncoder { /* private fields */ }Available on crate feature
video only.Expand description
A FrameSink that encodes the capture stream to a file.
Implementations§
Source§impl VideoEncoder
impl VideoEncoder
Sourcepub fn new(path: impl Into<PathBuf>, opts: Options) -> Result<Self>
pub fn new(path: impl Into<PathBuf>, opts: Options) -> Result<Self>
Create an encoder writing to path (container inferred from its extension,
e.g. .mp4/.mkv). The codec is opened lazily on the first frame.
Sourcepub fn resolved_backend(&self) -> Result<Backend>
pub fn resolved_backend(&self) -> Result<Backend>
The backend that will actually be used (resolves Auto); handy for logging.
Trait Implementations§
Source§impl FrameSink for VideoEncoder
impl FrameSink for VideoEncoder
Source§fn push_audio(&mut self, pcm: &[f32])
fn push_audio(&mut self, pcm: &[f32])
Buffer interleaved PCM ([AUDIO_CHANNELS] per frame, [AUDIO_RATE] Hz); it is
muxed on the next FrameSink::push. A no-op unless opts.audio is set. Bounded
while the pipeline warms up (no video frame yet) so it can’t grow without limit.
Source§fn push(&mut self, img: &CapturedImage, ts: Duration) -> Result<()>
fn push(&mut self, img: &CapturedImage, ts: Duration) -> Result<()>
Consume one CPU-pixel frame.
Source§fn finish(&mut self) -> Result<()>
fn finish(&mut self) -> Result<()>
Flush and finalize (write the file, close the encoder, …). Call once, last.
Source§fn push_dmabuf(
&mut self,
rb: &mut GpuReadback,
frame: DmabufFrame,
ts: Duration,
) -> Result<()>
fn push_dmabuf( &mut self, rb: &mut GpuReadback, frame: DmabufFrame, ts: Duration, ) -> Result<()>
Consume one GPU dma-buf frame. The default reads it back to CPU pixels via
rb and forwards to FrameSink::push; override to consume it on the GPU.Auto Trait Implementations§
impl !RefUnwindSafe for VideoEncoder
impl !Send for VideoEncoder
impl !Sync for VideoEncoder
impl !UnwindSafe for VideoEncoder
impl Freeze for VideoEncoder
impl Unpin for VideoEncoder
impl UnsafeUnpin for VideoEncoder
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> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.