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

ffmpeg.c:991:1: start of procedure do_video_stats()
989. }
990. 
991. static void do_video_stats(AVFormatContext *os, AVOutputStream *ost,
     ^
992.                            int frame_size)
993. {

ffmpeg.c:999:10: Taking true branch
 997. 
 998.     /* this is executed just the first time do_video_stats is called */
 999.     if (!vstats_file) {
               ^
1000.         vstats_file = fopen(vstats_filename, "w");
1001.         if (!vstats_file) {

ffmpeg.c:1000:9: 
 998.     /* this is executed just the first time do_video_stats is called */
 999.     if (!vstats_file) {
1000.         vstats_file = fopen(vstats_filename, "w");
              ^
1001.         if (!vstats_file) {
1002.             perror("fopen");

ffmpeg.c:1001:14: Taking true branch
 999.     if (!vstats_file) {
1000.         vstats_file = fopen(vstats_filename, "w");
1001.         if (!vstats_file) {
                   ^
1002.             perror("fopen");
1003.             av_exit(1);

ffmpeg.c:1002:13: 
1000.         vstats_file = fopen(vstats_filename, "w");
1001.         if (!vstats_file) {
1002.             perror("fopen");
                  ^
1003.             av_exit(1);
1004.         }

ffmpeg.c:1003:13: Skipping av_exit(): empty list of specs
1001.         if (!vstats_file) {
1002.             perror("fopen");
1003.             av_exit(1);
                  ^
1004.         }
1005.     }

ffmpeg.c:1007:5: 
1005.     }
1006. 
1007.     enc = ost->st->codec;
          ^
1008.     if (enc->codec_type == CODEC_TYPE_VIDEO) {
1009.         frame_number = ost->frame_number;

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

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

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