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

ffmpeg.c:1158:1: start of procedure do_video_stats()
1156. }
1157. 
1158. static void do_video_stats(AVFormatContext *os, AVOutputStream *ost,
      ^
1159.                            int frame_size)
1160. {

ffmpeg.c:1166:10: Taking true branch
1164. 
1165.     /* this is executed just the first time do_video_stats is called */
1166.     if (!vstats_file) {
               ^
1167.         vstats_file = fopen(vstats_filename, "w");
1168.         if (!vstats_file) {

ffmpeg.c:1167:9: 
1165.     /* this is executed just the first time do_video_stats is called */
1166.     if (!vstats_file) {
1167.         vstats_file = fopen(vstats_filename, "w");
              ^
1168.         if (!vstats_file) {
1169.             perror("fopen");

ffmpeg.c:1168:14: Taking true branch
1166.     if (!vstats_file) {
1167.         vstats_file = fopen(vstats_filename, "w");
1168.         if (!vstats_file) {
                   ^
1169.             perror("fopen");
1170.             av_exit(1);

ffmpeg.c:1169:13: 
1167.         vstats_file = fopen(vstats_filename, "w");
1168.         if (!vstats_file) {
1169.             perror("fopen");
                  ^
1170.             av_exit(1);
1171.         }

ffmpeg.c:1170:13: Skipping av_exit(): empty list of specs
1168.         if (!vstats_file) {
1169.             perror("fopen");
1170.             av_exit(1);
                  ^
1171.         }
1172.     }

ffmpeg.c:1174:5: 
1172.     }
1173. 
1174.     enc = ost->st->codec;
          ^
1175.     if (enc->codec_type == AVMEDIA_TYPE_VIDEO) {
1176.         frame_number = ost->frame_number;

ffmpeg.c:1175:9: Taking true branch
1173. 
1174.     enc = ost->st->codec;
1175.     if (enc->codec_type == AVMEDIA_TYPE_VIDEO) {
              ^
1176.         frame_number = ost->frame_number;
1177.         fprintf(vstats_file, "frame= %5d q= %2.1f ", frame_number, enc->coded_frame->quality/(float)FF_QP2LAMBDA);

ffmpeg.c:1176:9: 
1174.     enc = ost->st->codec;
1175.     if (enc->codec_type == AVMEDIA_TYPE_VIDEO) {
1176.         frame_number = ost->frame_number;
              ^
1177.         fprintf(vstats_file, "frame= %5d q= %2.1f ", frame_number, enc->coded_frame->quality/(float)FF_QP2LAMBDA);
1178.         if (enc->flags&CODEC_FLAG_PSNR)

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