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

ffmpeg.c:950:1: start of procedure do_video_stats()
948. }
949. 
950. static void do_video_stats(AVFormatContext *os, AVOutputStream *ost,
     ^
951.                            int frame_size)
952. {

ffmpeg.c:958:10: Taking true branch
956. 
957.     /* this is executed just the first time do_video_stats is called */
958.     if (!vstats_file) {
              ^
959.         vstats_file = fopen(vstats_filename, "w");
960.         if (!vstats_file) {

ffmpeg.c:959:9: 
957.     /* this is executed just the first time do_video_stats is called */
958.     if (!vstats_file) {
959.         vstats_file = fopen(vstats_filename, "w");
             ^
960.         if (!vstats_file) {
961.             perror("fopen");

ffmpeg.c:960:14: Taking true branch
958.     if (!vstats_file) {
959.         vstats_file = fopen(vstats_filename, "w");
960.         if (!vstats_file) {
                  ^
961.             perror("fopen");
962.             av_exit(1);

ffmpeg.c:961:13: 
959.         vstats_file = fopen(vstats_filename, "w");
960.         if (!vstats_file) {
961.             perror("fopen");
                 ^
962.             av_exit(1);
963.         }

ffmpeg.c:962:13: Skipping av_exit(): empty list of specs
960.         if (!vstats_file) {
961.             perror("fopen");
962.             av_exit(1);
                 ^
963.         }
964.     }

ffmpeg.c:966:5: 
964.     }
965. 
966.     enc = ost->st->codec;
         ^
967.     if (enc->codec_type == CODEC_TYPE_VIDEO) {
968.         frame_number = ost->frame_number;

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

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

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