[FFmpeg-devel] [PATCH] ffmpeg: show fps more accurately when it is small.
Nicolas George
nicolas.george at normalesup.org
Wed Mar 7 23:39:25 CET 2012
Signed-off-by: Nicolas George <nicolas.george at normalesup.org>
---
ffmpeg.c | 7 ++++---
1 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/ffmpeg.c b/ffmpeg.c
index 5499d5d..609d112 100644
--- a/ffmpeg.c
+++ b/ffmpeg.c
@@ -1715,11 +1715,12 @@ static void print_report(OutputFile *output_files,
snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "q=%2.1f ", q);
}
if (!vid && enc->codec_type == AVMEDIA_TYPE_VIDEO) {
- float t = (cur_time-timer_start) / 1000000.0;
+ float fps, t = (cur_time-timer_start) / 1000000.0;
frame_number = ost->frame_number;
- snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "frame=%5d fps=%3d q=%3.1f ",
- frame_number, (t > 1) ? (int)(frame_number / t + 0.5) : 0, q);
+ fps = t > 1 ? frame_number / t : 0;
+ snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "frame=%5d fps=%3.*f q=%3.1f ",
+ frame_number, fps < 9.95, fps, q);
if (is_last_report)
snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "L");
if (qp_hist) {
--
1.7.9.1
More information about the ffmpeg-devel
mailing list