changeset 4377:a7aa414b1bcf

bitrate calculator fix?
author arpi
date Sun, 27 Jan 2002 14:16:32 +0000
parents 118ae69769be
children 9cf9516e74cb
files mencoder.c
diffstat 1 files changed, 6 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/mencoder.c	Sun Jan 27 11:09:55 2002 +0000
+++ b/mencoder.c	Sun Jan 27 14:16:32 2002 +0000
@@ -319,6 +319,7 @@
 aviwrite_stream_t* mux_a=NULL;
 aviwrite_stream_t* mux_v=NULL;
 FILE* muxer_f=NULL;
+int muxer_f_size=0;
 
 #ifdef HAVE_DIVX4ENCORE
 ENC_FRAME enc_frame;
@@ -1432,17 +1433,18 @@
 
 printf("\nWriting AVI index...\n");
 aviwrite_write_index(muxer,muxer_f);
+muxer_f_size=ftell(muxer_f);
 printf("Fixup AVI header...\n");
 fseek(muxer_f,0,SEEK_SET);
 aviwrite_write_header(muxer,muxer_f); // update header
+fclose(muxer_f);
 
 if(out_video_codec==VCODEC_FRAMENO && mux_v->timer>100){
-    printf("Suggested video bitrate for 650MB CD: %d\n",(int)((650*1024*1024-ftell(muxer_f))/mux_v->timer/125));
-    printf("Suggested video bitrate for 700MB CD: %d\n",(int)((700*1024*1024-ftell(muxer_f))/mux_v->timer/125));
+    printf("Suggested video bitrate for 650MB CD: %d\n",(int)((650*1024*1024-muxer_f_size)/mux_v->timer/125));
+    printf("Suggested video bitrate for 700MB CD: %d\n",(int)((700*1024*1024-muxer_f_size)/mux_v->timer/125));
+    printf("Suggested video bitrate for 800MB CD: %d\n",(int)((800*1024*1024-muxer_f_size)/mux_v->timer/125));
 }
 
-fclose(muxer_f);
-
 printf("\nVideo stream: %8.3f kbit/s  (%d bps)  size: %d bytes  %5.3f secs  %d frames\n",
     (float)(mux_v->size/mux_v->timer*8.0f/1000.0f), (int)(mux_v->size/mux_v->timer), mux_v->size, (float)mux_v->timer, decoded_frameno);
 if(sh_audio)