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

ffmpeg.c:1107:1: start of procedure do_video_stats()
1105. }
1106. 
1107. static void do_video_stats(AVFormatContext *os, AVOutputStream *ost,
      ^
1108.                            int frame_size)
1109. {

ffmpeg.c:1115:10: Taking true branch
1113. 
1114.     /* this is executed just the first time do_video_stats is called */
1115.     if (!vstats_file) {
               ^
1116.         vstats_file = fopen(vstats_filename, "w");
1117.         if (!vstats_file) {

ffmpeg.c:1116:9: 
1114.     /* this is executed just the first time do_video_stats is called */
1115.     if (!vstats_file) {
1116.         vstats_file = fopen(vstats_filename, "w");
              ^
1117.         if (!vstats_file) {
1118.             perror("fopen");

ffmpeg.c:1117:14: Taking true branch
1115.     if (!vstats_file) {
1116.         vstats_file = fopen(vstats_filename, "w");
1117.         if (!vstats_file) {
                   ^
1118.             perror("fopen");
1119.             av_exit(1);

ffmpeg.c:1118:13: 
1116.         vstats_file = fopen(vstats_filename, "w");
1117.         if (!vstats_file) {
1118.             perror("fopen");
                  ^
1119.             av_exit(1);
1120.         }

ffmpeg.c:1119:13: Skipping av_exit(): empty list of specs
1117.         if (!vstats_file) {
1118.             perror("fopen");
1119.             av_exit(1);
                  ^
1120.         }
1121.     }

ffmpeg.c:1123:5: 
1121.     }
1122. 
1123.     enc = ost->st->codec;
          ^
1124.     if (enc->codec_type == CODEC_TYPE_VIDEO) {
1125.         frame_number = ost->frame_number;

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

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

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