summaryrefslogtreecommitdiff
path: root/ffmpeg.c
diff options
context:
space:
mode:
authorNicolas George <nicolas.george@normalesup.org>2012-03-07 23:26:29 +0100
committerNicolas George <nicolas.george@normalesup.org>2012-03-08 00:11:59 +0100
commit78306c51ef96b69b18bfaead078da5943a0174be (patch)
treed5c4433037d34939bf1efdf28ba6be165f2314b5 /ffmpeg.c
parenta8cdb7b95a7fb7f39eb06c0e4bc0af632b85ba47 (diff)
ffmpeg: show fps more accurately when it is small.
Diffstat (limited to 'ffmpeg.c')
-rw-r--r--ffmpeg.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/ffmpeg.c b/ffmpeg.c
index 5499d5d7bd..609d1121fb 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) {