From c121b2426879e531e42fb57b837dcc4ebabb8abe Mon Sep 17 00:00:00 2001 From: Kostya Shishkov Date: Thu, 13 Mar 2025 18:37:42 +0100 Subject: [PATCH] set audio encoder timebase to the first video stream timebase automatically This allows e.g. PCM encoder to calculate frame length. --- src/main.rs | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/main.rs b/src/main.rs index 6878a87..a093604 100644 --- a/src/main.rs +++ b/src/main.rs @@ -589,7 +589,7 @@ impl Transcoder { _ => {}, }; } - if self.global_tb != (0, 0) { + if self.global_tb != (0, 0) && oopts.enc_params.format.is_audio() { oopts.enc_params.tb_num = self.global_tb.0; oopts.enc_params.tb_den = self.global_tb.1; } @@ -1033,7 +1033,6 @@ fn main() { 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; @@ -1185,9 +1184,6 @@ fn main() { "--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, @@ -1277,7 +1273,7 @@ fn main() { 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 { + if transcoder.global_tb == (0, 0) && newstream.get_media_type() == StreamType::Video { transcoder.global_tb = newstream.get_timebase(); } newstream.id += start; -- 2.39.5