diff --git a/examples/ffmpeg_recorder.rs b/examples/ffmpeg_recorder.rs index 33cc495..e45ffa8 100644 --- a/examples/ffmpeg_recorder.rs +++ b/examples/ffmpeg_recorder.rs @@ -253,14 +253,7 @@ static bool ffmpeg_init_config(struct ff_config_param *params, //if encoded_packet.size() > 0 { encoded_packet.set_stream(stream_index); eprintln!("📦 Writing packet, pts {:?} dts {:?} size {}", encoded_packet.pts(), encoded_packet.dts(), encoded_packet.size()); - if let EncoderToWriteFrom::Video = encoder{ - //encoded_packet.rescale_ts(Rational(1, 60), Rational(1, 44100)); // slow, ~30fps - encoded_packet.rescale_ts(Rational(1, 60), Rational(1, 15360)); - } - if let EncoderToWriteFrom::Audio = encoder{ - //encoded_packet.rescale_ts(Rational(1, 60), Rational(1, 44100)); // slow, ~30fps - encoded_packet.rescale_ts(Rational(1, 60), Rational(1, 44100)); - } + encoded_packet.rescale_ts(Rational(1, 60), self.octx.stream(stream_index).unwrap().time_base()); eprintln!("📦 rescaled , pts {:?} dts {:?} size {}", encoded_packet.pts(), encoded_packet.dts(), encoded_packet.size()); match encoded_packet.write_interleaved(&mut self.octx) {