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

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

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

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

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

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

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

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

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

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

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