[xiph-commits] r16057 - trunk/ffmpeg2theora/src

j at svn.xiph.org j at svn.xiph.org
Fri May 29 08:03:09 PDT 2009


Author: j
Date: 2009-05-29 08:03:09 -0700 (Fri, 29 May 2009)
New Revision: 16057

Modified:
   trunk/ffmpeg2theora/src/theorautils.c
Log:
output estimated filesize

Modified: trunk/ffmpeg2theora/src/theorautils.c
===================================================================
--- trunk/ffmpeg2theora/src/theorautils.c	2009-05-28 22:51:30 UTC (rev 16056)
+++ trunk/ffmpeg2theora/src/theorautils.c	2009-05-29 15:03:09 UTC (rev 16057)
@@ -618,6 +618,16 @@
     return remaining;
 }
 
+static double estimated_size(oggmux_info *info, double timebase) {
+  double projected_size = 0;
+  double to_encode, time_so_far;
+
+  if (info->duration != -1 && timebase > 0) {
+    projected_size = ((info->audio_bytesout + info->video_bytesout)  /  timebase) * info->duration / 1024 / 1024;
+  }
+  return projected_size;
+}
+
 static void print_stats(oggmux_info *info, double timebase) {
     int hundredths = timebase * 100 - (long) timebase * 100;
     int seconds = (long) timebase % 60;
@@ -641,17 +651,18 @@
             remaining_seconds = (long) remaining % 60;
             remaining_minutes = ((long) remaining / 60) % 60;
             remaining_hours = (long) remaining / 3600;
-            fprintf (stderr,"\r      %d:%02d:%02d.%02d audio: %dkbps video: %dkbps, time elapsed: %02d:%02d:%02d      ",
+            fprintf (stderr,"\r      %d:%02d:%02d.%02d audio: %dkbps video: %dkbps, time elapsed: %02d:%02d:%02d                            ",
                 hours, minutes, seconds, hundredths,
                 info->akbps, info->vkbps,
                 remaining_hours, remaining_minutes, remaining_seconds
             );
         }
         else {
-            fprintf (stderr,"\r      %d:%02d:%02d.%02d audio: %dkbps video: %dkbps, time remaining: %02d:%02d:%02d      ",
+            fprintf (stderr,"\r      %d:%02d:%02d.%02d audio: %dkbps video: %dkbps, time remaining: %02d:%02d:%02d, est. size: %.01lf MB    ",
                 hours, minutes, seconds, hundredths,
                 info->akbps, info->vkbps,
-                remaining_hours, remaining_minutes, remaining_seconds
+                remaining_hours, remaining_minutes, remaining_seconds,
+                estimated_size(info, timebase)
             );
         }
     }



More information about the commits mailing list