ffmpeg.c:1041: error: Null Dereference
  pointer `vstats_file` last assigned on line 1031 could be null and is dereferenced by call to `fprintf()` at line 1041, column 9.

ffmpeg.c:1022:1: start of procedure do_video_stats()
1020. }
1021. 
1022. static void do_video_stats(AVFormatContext *os, AVOutputStream *ost,
      ^
1023.                            int frame_size)
1024. {

ffmpeg.c:1030:10: Taking true branch
1028. 
1029.     /* this is executed just the first time do_video_stats is called */
1030.     if (!vstats_file) {
               ^
1031.         vstats_file = fopen(vstats_filename, "w");
1032.         if (!vstats_file) {

ffmpeg.c:1031:9: 
1029.     /* this is executed just the first time do_video_stats is called */
1030.     if (!vstats_file) {
1031.         vstats_file = fopen(vstats_filename, "w");
              ^
1032.         if (!vstats_file) {
1033.             perror("fopen");

ffmpeg.c:1032:14: Taking true branch
1030.     if (!vstats_file) {
1031.         vstats_file = fopen(vstats_filename, "w");
1032.         if (!vstats_file) {
                   ^
1033.             perror("fopen");
1034.             av_exit(1);

ffmpeg.c:1033:13: 
1031.         vstats_file = fopen(vstats_filename, "w");
1032.         if (!vstats_file) {
1033.             perror("fopen");
                  ^
1034.             av_exit(1);
1035.         }

ffmpeg.c:1034:13: Skipping av_exit(): empty list of specs
1032.         if (!vstats_file) {
1033.             perror("fopen");
1034.             av_exit(1);
                  ^
1035.         }
1036.     }

ffmpeg.c:1038:5: 
1036.     }
1037. 
1038.     enc = ost->st->codec;
          ^
1039.     if (enc->codec_type == CODEC_TYPE_VIDEO) {
1040.         frame_number = ost->frame_number;

ffmpeg.c:1039:9: Taking true branch
1037. 
1038.     enc = ost->st->codec;
1039.     if (enc->codec_type == CODEC_TYPE_VIDEO) {
              ^
1040.         frame_number = ost->frame_number;
1041.         fprintf(vstats_file, "frame= %5d q= %2.1f ", frame_number, enc->coded_frame->quality/(float)FF_QP2LAMBDA);

ffmpeg.c:1040:9: 
1038.     enc = ost->st->codec;
1039.     if (enc->codec_type == CODEC_TYPE_VIDEO) {
1040.         frame_number = ost->frame_number;
              ^
1041.         fprintf(vstats_file, "frame= %5d q= %2.1f ", frame_number, enc->coded_frame->quality/(float)FF_QP2LAMBDA);
1042.         if (enc->flags&CODEC_FLAG_PSNR)

ffmpeg.c:1041:9: 
1039.     if (enc->codec_type == CODEC_TYPE_VIDEO) {
1040.         frame_number = ost->frame_number;
1041.         fprintf(vstats_file, "frame= %5d q= %2.1f ", frame_number, enc->coded_frame->quality/(float)FF_QP2LAMBDA);
              ^
1042.         if (enc->flags&CODEC_FLAG_PSNR)
1043.             fprintf(vstats_file, "PSNR= %6.2f ", psnr(enc->coded_frame->error[0]/(enc->width*enc->height*255.0*255.0)));
