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

ffmpeg.c:1283:1: start of procedure do_video_stats()
1281. }
1282. 
1283. static void do_video_stats(AVFormatContext *os, OutputStream *ost,
      ^
1284.                            int frame_size)
1285. {

ffmpeg.c:1291:10: Taking true branch
1289. 
1290.     /* this is executed just the first time do_video_stats is called */
1291.     if (!vstats_file) {
               ^
1292.         vstats_file = fopen(vstats_filename, "w");
1293.         if (!vstats_file) {

ffmpeg.c:1292:9: 
1290.     /* this is executed just the first time do_video_stats is called */
1291.     if (!vstats_file) {
1292.         vstats_file = fopen(vstats_filename, "w");
              ^
1293.         if (!vstats_file) {
1294.             perror("fopen");

ffmpeg.c:1293:14: Taking true branch
1291.     if (!vstats_file) {
1292.         vstats_file = fopen(vstats_filename, "w");
1293.         if (!vstats_file) {
                   ^
1294.             perror("fopen");
1295.             exit_program(1);

ffmpeg.c:1294:13: 
1292.         vstats_file = fopen(vstats_filename, "w");
1293.         if (!vstats_file) {
1294.             perror("fopen");
                  ^
1295.             exit_program(1);
1296.         }

ffmpeg.c:1295:13: Skipping exit_program(): empty list of specs
1293.         if (!vstats_file) {
1294.             perror("fopen");
1295.             exit_program(1);
                  ^
1296.         }
1297.     }

ffmpeg.c:1299:5: 
1297.     }
1298. 
1299.     enc = ost->st->codec;
          ^
1300.     if (enc->codec_type == AVMEDIA_TYPE_VIDEO) {
1301.         frame_number = ost->frame_number;

ffmpeg.c:1300:9: Taking true branch
1298. 
1299.     enc = ost->st->codec;
1300.     if (enc->codec_type == AVMEDIA_TYPE_VIDEO) {
              ^
1301.         frame_number = ost->frame_number;
1302.         fprintf(vstats_file, "frame= %5d q= %2.1f ", frame_number, enc->coded_frame->quality/(float)FF_QP2LAMBDA);

ffmpeg.c:1301:9: 
1299.     enc = ost->st->codec;
1300.     if (enc->codec_type == AVMEDIA_TYPE_VIDEO) {
1301.         frame_number = ost->frame_number;
              ^
1302.         fprintf(vstats_file, "frame= %5d q= %2.1f ", frame_number, enc->coded_frame->quality/(float)FF_QP2LAMBDA);
1303.         if (enc->flags&CODEC_FLAG_PSNR)

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