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

ffmpeg.c:1149:1: start of procedure do_video_stats()
1147. }
1148. 
1149. static void do_video_stats(AVFormatContext *os, AVOutputStream *ost,
      ^
1150.                            int frame_size)
1151. {

ffmpeg.c:1157:10: Taking true branch
1155. 
1156.     /* this is executed just the first time do_video_stats is called */
1157.     if (!vstats_file) {
               ^
1158.         vstats_file = fopen(vstats_filename, "w");
1159.         if (!vstats_file) {

ffmpeg.c:1158:9: 
1156.     /* this is executed just the first time do_video_stats is called */
1157.     if (!vstats_file) {
1158.         vstats_file = fopen(vstats_filename, "w");
              ^
1159.         if (!vstats_file) {
1160.             perror("fopen");

ffmpeg.c:1159:14: Taking true branch
1157.     if (!vstats_file) {
1158.         vstats_file = fopen(vstats_filename, "w");
1159.         if (!vstats_file) {
                   ^
1160.             perror("fopen");
1161.             av_exit(1);

ffmpeg.c:1160:13: 
1158.         vstats_file = fopen(vstats_filename, "w");
1159.         if (!vstats_file) {
1160.             perror("fopen");
                  ^
1161.             av_exit(1);
1162.         }

ffmpeg.c:1161:13: Skipping av_exit(): empty list of specs
1159.         if (!vstats_file) {
1160.             perror("fopen");
1161.             av_exit(1);
                  ^
1162.         }
1163.     }

ffmpeg.c:1165:5: 
1163.     }
1164. 
1165.     enc = ost->st->codec;
          ^
1166.     if (enc->codec_type == AVMEDIA_TYPE_VIDEO) {
1167.         frame_number = ost->frame_number;

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

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

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