Commit 8093e4ee authored by Vibhoothi's avatar Vibhoothi Committed by Luca Barbato
Browse files

Add an optional --skip parameter

This commit introduces new feature of skipping n frames of video when encoding
where the input is taken via CLI with optional --skip parameter.
parent d27db75e
......@@ -28,6 +28,7 @@ pub struct CliOptions {
pub io: EncoderIO,
pub enc: EncoderConfig,
pub limit: usize,
pub skip: usize,
pub verbose: bool,
}
......@@ -87,6 +88,13 @@ pub fn parse_cli() -> CliOptions {
.takes_value(true)
.default_value("0")
)
.arg(
Arg::with_name("SKIP")
.help("Skip n number of frames and encode")
.long("skip")
.takes_value(true)
.default_value("0")
)
.arg(
Arg::with_name("QP")
.help("Quantizer (0-255), smaller values are higher quality [default: 100]")
......@@ -285,6 +293,7 @@ pub fn parse_cli() -> CliOptions {
io,
enc: parse_config(&matches),
limit: matches.value_of("LIMIT").unwrap().parse().unwrap(),
skip: matches.value_of("SKIP").unwrap().parse().unwrap(),
verbose: matches.is_present("VERBOSE"),
}
}
......
......@@ -144,6 +144,12 @@ fn main() {
);
ctx.set_limit(cli.limit as u64);
let mut frame_current_count = 0;
while frame_current_count <= cli.skip {
y4m_dec.read_frame().expect("Skipped more frames than in the input");
frame_current_count+=1;
}
while let Ok(frame_info) = process_frame(&mut ctx, &mut cli.io.output, &mut y4m_dec, y4m_enc.as_mut()) {
for frame in frame_info {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment