calc_len: bool,
nframes: Vec<usize>,
+ global_tb: (u32, u32),
}
macro_rules! parse_and_apply_options {
_ => {},
};
}
+ if self.global_tb != (0, 0) {
+ oopts.enc_params.tb_num = self.global_tb.0;
+ oopts.enc_params.tb_den = self.global_tb.1;
+ }
if oopts.enc_params.tb_num == 0 {
oopts.enc_params.tb_num = istr.tb_num;
oopts.enc_params.tb_den = istr.tb_den;
}
let mut encoder = (enc_create.unwrap())();
oopts.enc_params.format = istr.get_info().get_properties();
- oopts.enc_params.tb_num = istr.tb_num;
- oopts.enc_params.tb_den = istr.tb_den;
+ if self.global_tb != (0, 0) {
+ oopts.enc_params.tb_num = self.global_tb.0;
+ oopts.enc_params.tb_den = self.global_tb.1;
+ } else {
+ oopts.enc_params.tb_num = istr.tb_num;
+ oopts.enc_params.tb_den = istr.tb_den;
+ }
let ret_eparams = encoder.negotiate_format(&oopts.enc_params);
if ret_eparams.is_err() {
println!("cannot negotiate encoding parameters");
let full_reg = FullRegister::new();
let mut transcoder = Transcoder::new();
+ let mut use_video_tb = false;
let mut arg_idx = 1;
let mut printed_info = false;
"--calc-len" => {
transcoder.calc_len = true;
},
+ "--use-video-tb" => {
+ use_video_tb = true;
+ },
"--verbose" | "-v" => transcoder.verbose = 1,
"-vv" => transcoder.verbose = 2,
"-v-" => transcoder.verbose = 0,
let max_id = sm.iter().fold(0u32, |id, strm| id.max(strm.id));
for stream in sm.iter() {
let mut newstream = (*stream).clone();
+ if use_video_tb && transcoder.global_tb == (0, 0) && newstream.get_media_type() == StreamType::Video {
+ transcoder.global_tb = newstream.get_timebase();
+ }
newstream.id += start;
ism.add_stream(newstream);
}