[FFmpeg-cvslog] fftools/ffmpeg: replace stream timebase with decoded frame one

Anton Khirnov git at videolan.org
Mon May 22 18:11:17 EEST 2023


ffmpeg | branch: master | Anton Khirnov <anton at khirnov.net> | Wed May 10 09:02:43 2023 +0200| [7b41785eb604152dd99c3e58f4999c2b0cd4c681] | committer: Anton Khirnov

fftools/ffmpeg: replace stream timebase with decoded frame one

They are the same for now, but this may change in the future.

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=7b41785eb604152dd99c3e58f4999c2b0cd4c681
---

 fftools/ffmpeg.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c
index 60f0ff3b12..9e5e56e9e7 100644
--- a/fftools/ffmpeg.c
+++ b/fftools/ffmpeg.c
@@ -993,7 +993,7 @@ static int64_t video_duration_estimate(const InputStream *ist, const AVFrame *fr
         AVRational field_rate = av_mul_q(ist->dec_ctx->framerate,
                                          (AVRational){ 2, 1 });
         codec_duration = av_rescale_q(fields, av_inv_q(field_rate),
-                                      ist->st->time_base);
+                                      frame->time_base);
     }
 
     // prefer codec-layer duration for containers without timestamps
@@ -1015,7 +1015,7 @@ static int64_t video_duration_estimate(const InputStream *ist, const AVFrame *fr
     // try average framerate
     if (ist->st->avg_frame_rate.num && ist->st->avg_frame_rate.den) {
         int64_t d = av_rescale_q(1, av_inv_q(ist->st->avg_frame_rate),
-                                 ist->st->time_base);
+                                 frame->time_base);
         if (d > 0)
             return d;
     }
@@ -1110,13 +1110,13 @@ static int decode_video(InputStream *ist, const AVPacket *pkt, int *got_output,
                "duration:%s duration_time:%s "
                "keyframe:%d frame_type:%d time_base:%d/%d\n",
                av_ts2str(frame->pts),
-               av_ts2timestr(frame->pts, &ist->st->time_base),
+               av_ts2timestr(frame->pts, &frame->time_base),
                av_ts2str(frame->pkt_dts),
-               av_ts2timestr(frame->pkt_dts, &ist->st->time_base),
+               av_ts2timestr(frame->pkt_dts, &frame->time_base),
                av_ts2str(frame->duration),
-               av_ts2timestr(frame->duration, &ist->st->time_base),
+               av_ts2timestr(frame->duration, &frame->time_base),
                !!(frame->flags & AV_FRAME_FLAG_KEY), frame->pict_type,
-               ist->st->time_base.num, ist->st->time_base.den);
+               frame->time_base.num, frame->time_base.den);
     }
 
     if (ist->st->sample_aspect_ratio.num)



More information about the ffmpeg-cvslog mailing list