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

ffmpeg.c:1017:1: start of procedure do_video_stats()
1015. }
1016. 
1017. static void do_video_stats(AVFormatContext *os, AVOutputStream *ost,
      ^
1018.                            int frame_size)
1019. {

ffmpeg.c:1025:10: Taking true branch
1023. 
1024.     /* this is executed just the first time do_video_stats is called */
1025.     if (!vstats_file) {
               ^
1026.         vstats_file = fopen(vstats_filename, "w");
1027.         if (!vstats_file) {

ffmpeg.c:1026:9: 
1024.     /* this is executed just the first time do_video_stats is called */
1025.     if (!vstats_file) {
1026.         vstats_file = fopen(vstats_filename, "w");
              ^
1027.         if (!vstats_file) {
1028.             perror("fopen");

ffmpeg.c:1027:14: Taking true branch
1025.     if (!vstats_file) {
1026.         vstats_file = fopen(vstats_filename, "w");
1027.         if (!vstats_file) {
                   ^
1028.             perror("fopen");
1029.             av_exit(1);

ffmpeg.c:1028:13: 
1026.         vstats_file = fopen(vstats_filename, "w");
1027.         if (!vstats_file) {
1028.             perror("fopen");
                  ^
1029.             av_exit(1);
1030.         }

ffmpeg.c:1029:13: Skipping av_exit(): empty list of specs
1027.         if (!vstats_file) {
1028.             perror("fopen");
1029.             av_exit(1);
                  ^
1030.         }
1031.     }

ffmpeg.c:1033:5: 
1031.     }
1032. 
1033.     enc = ost->st->codec;
          ^
1034.     if (enc->codec_type == CODEC_TYPE_VIDEO) {
1035.         frame_number = ost->frame_number;

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

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

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