[FFmpeg-cvslog] In print_report, print progression time in hours:mins:secs:us

Baptiste Coudurier git at videolan.org
Fri Jun 3 03:52:12 CEST 2011


ffmpeg | branch: master | Baptiste Coudurier <baptiste.coudurier at gmail.com> | Fri Jun  3 00:29:36 2011 +0200| [dd471070215c5ca78f2cb99efc66ea5e33b39808] | committer: Michael Niedermayer

In print_report, print progression time in hours:mins:secs:us

Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

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

 ffmpeg.c |   16 ++++++++++++++--
 1 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/ffmpeg.c b/ffmpeg.c
index 0f32266..a78adf3 100644
--- a/ffmpeg.c
+++ b/ffmpeg.c
@@ -1460,11 +1460,23 @@ static void print_report(AVFormatContext **output_files,
     }
 
     if (verbose > 0 || is_last_report) {
+        int hours, mins, secs, us;
+        secs = pts / AV_TIME_BASE;
+        us = pts % AV_TIME_BASE;
+        mins = secs / 60;
+        secs %= 60;
+        hours = mins / 60;
+        mins %= 60;
+
         bitrate = pts ? total_size * 8 / (pts / 1000.0) : 0;
 
         snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf),
-            "size=%8.0fkB time=%0.2f bitrate=%6.1fkbits/s",
-            (double)total_size / 1024, pts/(double)AV_TIME_BASE, bitrate);
+                 "size=%8.0fkB time=", total_size / 1024.0);
+        snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf),
+                 "%02d:%02d:%02d.%02d ", hours, mins, secs,
+                 (100 * us) / AV_TIME_BASE);
+        snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf),
+                 "bitrate=%6.1fkbits/s", bitrate);
 
         if (nb_frames_dup || nb_frames_drop)
           snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), " dup=%d drop=%d",



More information about the ffmpeg-cvslog mailing list