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

ffmpeg.c:1297:1: start of procedure do_video_stats()
1295. }
1296. 
1297. static void do_video_stats(AVFormatContext *os, AVOutputStream *ost,
      ^
1298.                            int frame_size)
1299. {

ffmpeg.c:1305:10: Taking true branch
1303. 
1304.     /* this is executed just the first time do_video_stats is called */
1305.     if (!vstats_file) {
               ^
1306.         vstats_file = fopen(vstats_filename, "w");
1307.         if (!vstats_file) {

ffmpeg.c:1306:9: 
1304.     /* this is executed just the first time do_video_stats is called */
1305.     if (!vstats_file) {
1306.         vstats_file = fopen(vstats_filename, "w");
              ^
1307.         if (!vstats_file) {
1308.             perror("fopen");

ffmpeg.c:1307:14: Taking true branch
1305.     if (!vstats_file) {
1306.         vstats_file = fopen(vstats_filename, "w");
1307.         if (!vstats_file) {
                   ^
1308.             perror("fopen");
1309.             ffmpeg_exit(1);

ffmpeg.c:1308:13: 
1306.         vstats_file = fopen(vstats_filename, "w");
1307.         if (!vstats_file) {
1308.             perror("fopen");
                  ^
1309.             ffmpeg_exit(1);
1310.         }

ffmpeg.c:1309:13: Skipping ffmpeg_exit(): empty list of specs
1307.         if (!vstats_file) {
1308.             perror("fopen");
1309.             ffmpeg_exit(1);
                  ^
1310.         }
1311.     }

ffmpeg.c:1313:5: 
1311.     }
1312. 
1313.     enc = ost->st->codec;
          ^
1314.     if (enc->codec_type == AVMEDIA_TYPE_VIDEO) {
1315.         frame_number = ost->frame_number;

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

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

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