static void do_video_stats(AVOutputStream *ost, 

                         AVInputStream *ist,

                         int frame_size)

{

    static FILE *fvstats=NULL;

    static INT64 total_size = 0;

    struct tm *today;

    time_t today2;

    char filename[40];

    AVCodecContext *enc;

    int frame_number;

    INT64 ti;

    double ti1, bitrate, avg_bitrate;

    

    if (!fvstats) {

        today2 = time(NULL);

        today = localtime(&today2);

        sprintf(filename, "vstats_%02d%02d%02d.log", today->tm_hour,

                                               today->tm_min,

                                               today->tm_sec);

        fvstats = fopen(filename,"w");

        if (!fvstats) {

            perror("fopen");

            exit(1);

        }

    }

    

    ti = MAXINT64;

    enc = &ost->st->codec;

    total_size += frame_size;

    if (enc->codec_type == CODEC_TYPE_VIDEO) {

        frame_number = ist->frame_number;

        fprintf(fvstats, "frame= %5d q= %2d ", frame_number, enc->quality);

        if (do_psnr)

            fprintf(fvstats, "PSNR= %6.2f ", enc->psnr_y);

        

        fprintf(fvstats,"f_size= %6d ", frame_size);

        /* compute min pts value */

        if (!ist->discard && ist->pts < ti) {

            ti = ist->pts;

        }

        ti1 = (double)ti / 1000000.0;

        if (ti1 < 0.01)

            ti1 = 0.01;

    

        bitrate = (double)(frame_size * 8) * enc->frame_rate / FRAME_RATE_BASE / 1000.0;

        avg_bitrate = (double)(total_size * 8) / ti1 / 1000.0;

        fprintf(fvstats, "s_size= %8.0fkB time= %0.3f br= %7.1fkbits/s avg_br= %7.1fkbits/s ",

            (double)total_size / 1024, ti1, bitrate, avg_bitrate);

        fprintf(fvstats,"type= %s\n", enc->key_frame == 1 ? "I" : "P");        

    }



    

    

}

static void do_video_stats(AVOutputStream *ost, 

                         AVInputStream *ist,

                         int frame_size)

{

    static FILE *fvstats=NULL;

    static INT64 total_size = 0;

    struct tm *today;

    time_t today2;

    char filename[40];

    AVCodecContext *enc;

    int frame_number;

    INT64 ti;

    double ti1, bitrate, avg_bitrate;

    

    if (!fvstats) {

        today2 = time(NULL);

        today = localtime(&today2);

        sprintf(filename, "vstats_%02d%02d%02d.log", today->tm_hour,

                                               today->tm_min,

                                               today->tm_sec);

        fvstats = fopen(filename,"w");

        if (!fvstats) {

            perror("fopen");

            exit(1);

        }

    }

    

    ti = MAXINT64;

    enc = &ost->st->codec;

    total_size += frame_size;

    if (enc->codec_type == CODEC_TYPE_VIDEO) {

        frame_number = ist->frame_number;

        fprintf(fvstats, "frame= %5d q= %2d ", frame_number, enc->quality);

        if (do_psnr)

            fprintf(fvstats, "PSNR= %6.2f ", enc->psnr_y);

        

        fprintf(fvstats,"f_size= %6d ", frame_size);

        

        if (!ist->discard && ist->pts < ti) {

            ti = ist->pts;

        }

        ti1 = (double)ti / 1000000.0;

        if (ti1 < 0.01)

            ti1 = 0.01;

    

        bitrate = (double)(frame_size * 8) * enc->frame_rate / FRAME_RATE_BASE / 1000.0;

        avg_bitrate = (double)(total_size * 8) / ti1 / 1000.0;

        fprintf(fvstats, "s_size= %8.0fkB time= %0.3f br= %7.1fkbits/s avg_br= %7.1fkbits/s ",

            (double)total_size / 1024, ti1, bitrate, avg_bitrate);

        fprintf(fvstats,"type= %s\n", enc->key_frame == 1 ? "I" : "P");        

    }



    

    

}

    struct tm *today;     time_t today2;
static void FUNC_0(AVOutputStream *VAR_0, 

                         AVInputStream *VAR_1,

                         int VAR_2)

{

    static FILE *VAR_3=NULL;

    static INT64 VAR_4 = 0;

    struct tm *VAR_5;

    time_t today2;

    char VAR_6[40];

    AVCodecContext *enc;

    int VAR_7;

    INT64 ti;

    double VAR_8, VAR_9, VAR_10;

    

    if (!VAR_3) {

        today2 = time(NULL);

        VAR_5 = localtime(&today2);

        sprintf(VAR_6, "vstats_%02d%02d%02d.log", VAR_5->tm_hour,

                                               VAR_5->tm_min,

                                               VAR_5->tm_sec);

        VAR_3 = fopen(VAR_6,"w");

        if (!VAR_3) {

            perror("fopen");

            exit(1);

        }

    }

    

    ti = MAXINT64;

    enc = &VAR_0->st->codec;

    VAR_4 += VAR_2;

    if (enc->codec_type == CODEC_TYPE_VIDEO) {

        VAR_7 = VAR_1->VAR_7;

        fprintf(VAR_3, "frame= %5d q= %2d ", VAR_7, enc->quality);

        if (do_psnr)

            fprintf(VAR_3, "PSNR= %6.2f ", enc->psnr_y);

        

        fprintf(VAR_3,"f_size= %6d ", VAR_2);

        

        if (!VAR_1->discard && VAR_1->pts < ti) {

            ti = VAR_1->pts;

        }

        VAR_8 = (double)ti / 1000000.0;

        if (VAR_8 < 0.01)

            VAR_8 = 0.01;

    

        VAR_9 = (double)(VAR_2 * 8) * enc->frame_rate / FRAME_RATE_BASE / 1000.0;

        VAR_10 = (double)(VAR_4 * 8) / VAR_8 / 1000.0;

        fprintf(VAR_3, "s_size= %8.0fkB time= %0.3f br= %7.1fkbits/s avg_br= %7.1fkbits/s ",

            (double)VAR_4 / 1024, VAR_8, VAR_9, VAR_10);

        fprintf(VAR_3,"type= %s\n", enc->key_frame == 1 ? "I" : "P");        

    }



    

    

}

static void FUNC_0(AVOutputStream *VAR_0,
AVInputStream *VAR_1,
int VAR_2)
{ static FILE *VAR_3=NULL; static INT64 VAR_4 = 0; struct tm *VAR_5; time_t today2; char VAR_6[40]; AVCodecContext *enc; int VAR_7; INT64 ti; double VAR_8, VAR_9, VAR_10; if (!VAR_3) { today2 = time(NULL); VAR_5 = localtime(&today2); sprintf(VAR_6, "vstats_%02d%02d%02d.log", VAR_5->tm_hour,
VAR_5->tm_min,
VAR_5->tm_sec); VAR_3 = fopen(VAR_6,"w"); if (!VAR_3) { perror("fopen"); exit(1); } } ti = MAXINT64; enc = &VAR_0->st->codec; VAR_4 += VAR_2; if (enc->codec_type == CODEC_TYPE_VIDEO) { VAR_7 = VAR_1->VAR_7; fprintf(VAR_3, "frame= %5d q= %2d ", VAR_7, enc->quality); if (do_psnr)
fprintf(VAR_3, "PSNR= %6.2f ", enc->psnr_y); fprintf(VAR_3,"f_size= %6d ", VAR_2); if (!VAR_1->discard && VAR_1->pts < ti) { ti = VAR_1->pts; } VAR_8 = (double)ti / 1000000.0; if (VAR_8 < 0.01)
VAR_8 = 0.01; VAR_9 = (double)(VAR_2 * 8) * enc->frame_rate / FRAME_RATE_BASE / 1000.0; VAR_10 = (double)(VAR_4 * 8) / VAR_8 / 1000.0; fprintf(VAR_3, "s_size= %8.0fkB time= %0.3f br= %7.1fkbits/s avg_br= %7.1fkbits/s ",
(double)VAR_4 / 1024, VAR_8, VAR_9, VAR_10); fprintf(VAR_3,"type= %s\n", enc->key_frame == 1 ? "I" : "P"); } }