[FFmpeg-devel] [PATCH 25/35] fftools/ffmpeg: stop using OutputStream.frame_number in print_report()

Anton Khirnov anton at khirnov.net
Thu Jun 16 22:55:24 EEST 2022


This field means different things when the video is encoded (number of
frames emitted to the encoding sync queue/encoder by the video sync
code) or copied (number of packets sent to the muxer sync queue).

Print the value of packets_written instead, which means the same thing
in both cases. It is also more accurate, since packets may be dropped by
the sync queue or bitstream filters.
---
 fftools/ffmpeg.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c
index a471fa0f8f..beb07928bf 100644
--- a/fftools/ffmpeg.c
+++ b/fftools/ffmpeg.c
@@ -1585,7 +1585,7 @@ static void print_report(int is_last_report, int64_t timer_start, int64_t cur_ti
         if (!vid && enc->codec_type == AVMEDIA_TYPE_VIDEO) {
             float fps;
 
-            frame_number = ost->frame_number;
+            frame_number = ost->packets_written;
             fps = t > 1 ? frame_number / t : 0;
             av_bprintf(&buf, "frame=%5d fps=%3.*f q=%3.1f ",
                      frame_number, fps < 9.95, fps, q);
-- 
2.34.1



More information about the ffmpeg-devel mailing list