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

ffmpeg.c:1080:1: start of procedure do_video_stats()
1078. }
1079. 
1080. static void do_video_stats(AVFormatContext *os, AVOutputStream *ost,
      ^
1081.                            int frame_size)
1082. {

ffmpeg.c:1088:10: Taking true branch
1086. 
1087.     /* this is executed just the first time do_video_stats is called */
1088.     if (!vstats_file) {
               ^
1089.         vstats_file = fopen(vstats_filename, "w");
1090.         if (!vstats_file) {

ffmpeg.c:1089:9: 
1087.     /* this is executed just the first time do_video_stats is called */
1088.     if (!vstats_file) {
1089.         vstats_file = fopen(vstats_filename, "w");
              ^
1090.         if (!vstats_file) {
1091.             perror("fopen");

ffmpeg.c:1090:14: Taking true branch
1088.     if (!vstats_file) {
1089.         vstats_file = fopen(vstats_filename, "w");
1090.         if (!vstats_file) {
                   ^
1091.             perror("fopen");
1092.             av_exit(1);

ffmpeg.c:1091:13: 
1089.         vstats_file = fopen(vstats_filename, "w");
1090.         if (!vstats_file) {
1091.             perror("fopen");
                  ^
1092.             av_exit(1);
1093.         }

ffmpeg.c:1092:13: Skipping av_exit(): empty list of specs
1090.         if (!vstats_file) {
1091.             perror("fopen");
1092.             av_exit(1);
                  ^
1093.         }
1094.     }

ffmpeg.c:1096:5: 
1094.     }
1095. 
1096.     enc = ost->st->codec;
          ^
1097.     if (enc->codec_type == CODEC_TYPE_VIDEO) {
1098.         frame_number = ost->frame_number;

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

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

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