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

ffmpeg.c:1178:1: start of procedure do_video_stats()
1176. }
1177. 
1178. static void do_video_stats(AVFormatContext *os, AVOutputStream *ost,
      ^
1179.                            int frame_size)
1180. {

ffmpeg.c:1186:10: Taking true branch
1184. 
1185.     /* this is executed just the first time do_video_stats is called */
1186.     if (!vstats_file) {
               ^
1187.         vstats_file = fopen(vstats_filename, "w");
1188.         if (!vstats_file) {

ffmpeg.c:1187:9: 
1185.     /* this is executed just the first time do_video_stats is called */
1186.     if (!vstats_file) {
1187.         vstats_file = fopen(vstats_filename, "w");
              ^
1188.         if (!vstats_file) {
1189.             perror("fopen");

ffmpeg.c:1188:14: Taking true branch
1186.     if (!vstats_file) {
1187.         vstats_file = fopen(vstats_filename, "w");
1188.         if (!vstats_file) {
                   ^
1189.             perror("fopen");
1190.             av_exit(1);

ffmpeg.c:1189:13: 
1187.         vstats_file = fopen(vstats_filename, "w");
1188.         if (!vstats_file) {
1189.             perror("fopen");
                  ^
1190.             av_exit(1);
1191.         }

ffmpeg.c:1190:13: Skipping av_exit(): empty list of specs
1188.         if (!vstats_file) {
1189.             perror("fopen");
1190.             av_exit(1);
                  ^
1191.         }
1192.     }

ffmpeg.c:1194:5: 
1192.     }
1193. 
1194.     enc = ost->st->codec;
          ^
1195.     if (enc->codec_type == AVMEDIA_TYPE_VIDEO) {
1196.         frame_number = ost->frame_number;

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

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

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