[FFmpeg-cvslog] avconv: Do not divide by zero

Luca Barbato git at videolan.org
Mon Mar 3 23:27:06 CET 2014


ffmpeg | branch: release/2.2 | Luca Barbato <lu_zero at gentoo.org> | Wed Feb 19 21:41:12 2014 +0100| [bc2c9a479aee3bed3dcb06245a008c93a01672c5] | committer: Reinhard Tartler

avconv: Do not divide by zero

(cherry picked from commit 5c79d2e12d13959fc6aed92d102c25194a06de05)

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

 avconv.c |   10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/avconv.c b/avconv.c
index edce1e5..64e8321 100644
--- a/avconv.c
+++ b/avconv.c
@@ -858,14 +858,18 @@ static void print_report(int is_last_report, int64_t timer_start)
     fflush(stderr);
 
     if (is_last_report) {
-        int64_t raw= audio_size + video_size + extra_size;
+        int64_t raw   = audio_size + video_size + extra_size;
+        float percent = 0.0;
+
+        if (raw)
+            percent = 100.0 * (total_size - raw) / raw;
+
         av_log(NULL, AV_LOG_INFO, "\n");
         av_log(NULL, AV_LOG_INFO, "video:%1.0fkB audio:%1.0fkB global headers:%1.0fkB muxing overhead %f%%\n",
                video_size / 1024.0,
                audio_size / 1024.0,
                extra_size / 1024.0,
-               100.0 * (total_size - raw) / raw
-        );
+               percent);
     }
 }
 



More information about the ffmpeg-cvslog mailing list