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

ffmpeg.c:1372:1: start of procedure do_video_stats()
1370. }
1371. 
1372. static void do_video_stats(AVFormatContext *os, AVOutputStream *ost,
      ^
1373.                            int frame_size)
1374. {

ffmpeg.c:1380:10: Taking true branch
1378. 
1379.     /* this is executed just the first time do_video_stats is called */
1380.     if (!vstats_file) {
               ^
1381.         vstats_file = fopen(vstats_filename, "w");
1382.         if (!vstats_file) {

ffmpeg.c:1381:9: 
1379.     /* this is executed just the first time do_video_stats is called */
1380.     if (!vstats_file) {
1381.         vstats_file = fopen(vstats_filename, "w");
              ^
1382.         if (!vstats_file) {
1383.             perror("fopen");

ffmpeg.c:1382:14: Taking true branch
1380.     if (!vstats_file) {
1381.         vstats_file = fopen(vstats_filename, "w");
1382.         if (!vstats_file) {
                   ^
1383.             perror("fopen");
1384.             ffmpeg_exit(1);

ffmpeg.c:1383:13: 
1381.         vstats_file = fopen(vstats_filename, "w");
1382.         if (!vstats_file) {
1383.             perror("fopen");
                  ^
1384.             ffmpeg_exit(1);
1385.         }

ffmpeg.c:1384:13: Skipping ffmpeg_exit(): empty list of specs
1382.         if (!vstats_file) {
1383.             perror("fopen");
1384.             ffmpeg_exit(1);
                  ^
1385.         }
1386.     }

ffmpeg.c:1388:5: 
1386.     }
1387. 
1388.     enc = ost->st->codec;
          ^
1389.     if (enc->codec_type == AVMEDIA_TYPE_VIDEO) {
1390.         frame_number = ost->frame_number;

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

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

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