[FFmpeg-devel] [PATCH] fftools/ffmpeg: log correct filter timebase with debug_ts

Timo Rothenpieler timo at rothenpieler.org
Tue Jul 5 18:25:26 EEST 2022


---
 fftools/ffmpeg.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c
index e7384f052a..6ec28f3019 100644
--- a/fftools/ffmpeg.c
+++ b/fftools/ffmpeg.c
@@ -766,6 +766,7 @@ static double adjust_frame_pts_to_encoder_tb(OutputFile *of, OutputStream *ost,
 {
     double float_pts = AV_NOPTS_VALUE; // this is identical to frame.pts but with higher precision
     AVCodecContext *enc = ost->enc_ctx;
+    AVRational filter_tb = (AVRational){ -1, -1 };
     if (!frame || frame->pts == AV_NOPTS_VALUE ||
         !enc || !ost->filter || !ost->filter->graph->graph)
         goto early_exit;
@@ -774,9 +775,9 @@ static double adjust_frame_pts_to_encoder_tb(OutputFile *of, OutputStream *ost,
         AVFilterContext *filter = ost->filter->filter;
 
         int64_t start_time = (of->start_time == AV_NOPTS_VALUE) ? 0 : of->start_time;
-        AVRational filter_tb = av_buffersink_get_time_base(filter);
         AVRational tb = enc->time_base;
         int extra_bits = av_clip(29 - av_log2(tb.den), 0, 16);
+        filter_tb = av_buffersink_get_time_base(filter);
 
         tb.den <<= extra_bits;
         float_pts =
@@ -798,8 +799,8 @@ early_exit:
                frame ? av_ts2str(frame->pts) : "NULL",
                frame ? av_ts2timestr(frame->pts, &enc->time_base) : "NULL",
                float_pts,
-               enc ? enc->time_base.num : -1,
-               enc ? enc->time_base.den : -1);
+               filter_tb.num,
+               filter_tb.den);
     }
 
     return float_pts;
-- 
2.34.1



More information about the ffmpeg-devel mailing list