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

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

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

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

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

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

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

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

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

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

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