Struct mpeg_encoder::Encoder
[−]
[src]
pub struct Encoder { /* fields omitted */ }
MPEG video recorder.
Methods
impl Encoder
[src]
pub fn new<P: AsRef<Path>>(path: P, width: usize, height: usize) -> Encoder
[src]
Creates a new video recorder.
Arguments:
path
- path to the output file.width
- width of the recorded video.height
- height of the recorded video.
pub fn new_with_params<P: AsRef<Path>>(
path: P,
width: usize,
height: usize,
bit_rate: Option<usize>,
time_base: Option<(usize, usize)>,
gop_size: Option<usize>,
max_b_frames: Option<usize>,
pix_fmt: Option<AVPixelFormat>
) -> Encoder
[src]
path: P,
width: usize,
height: usize,
bit_rate: Option<usize>,
time_base: Option<(usize, usize)>,
gop_size: Option<usize>,
max_b_frames: Option<usize>,
pix_fmt: Option<AVPixelFormat>
) -> Encoder
Creates a new video recorder with custom recording parameters.
Arguments:
path
- path to the output file.width
- width of the recorded video.height
- height of the recorded video.bit_rate
- the average bit rate. Default value: 400000.time_base
- this is the fundamental unit of time (in seconds) in terms of which frame timestamps are represented. Default value: (1, 60), i-e, 60fps.gop_size
- the number of pictures in a group of pictures. Default value: 10.max_b_frames
- maximum number of B-frames between non-B-frames. Default value: 1.pix_fmt
- pixel format. Default value:AVPixelFormat::PIX_FMT_YUV420P
.
pub fn encode_rgb(
&mut self,
width: usize,
height: usize,
data: &[u8],
vertical_flip: bool
)
[src]
&mut self,
width: usize,
height: usize,
data: &[u8],
vertical_flip: bool
)
Adds a image with a RGB pixel format to the video.
pub fn encode_rgba(
&mut self,
width: usize,
height: usize,
data: &[u8],
vertical_flip: bool
)
[src]
&mut self,
width: usize,
height: usize,
data: &[u8],
vertical_flip: bool
)
Adds a image with a RGBA pixel format to the video.
pub fn init(&mut self)
[src]
Initializes the recorder if needed.
This is automatically called when the first snapshot is made. Call this explicitly if you do not want the extra time overhead when the first snapshot is made.