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

ffmpeg.c:1330:1: start of procedure do_video_stats()
1328. }
1329. 
1330. static void do_video_stats(AVFormatContext *os, AVOutputStream *ost,
      ^
1331.                            int frame_size)
1332. {

ffmpeg.c:1338:10: Taking true branch
1336. 
1337.     /* this is executed just the first time do_video_stats is called */
1338.     if (!vstats_file) {
               ^
1339.         vstats_file = fopen(vstats_filename, "w");
1340.         if (!vstats_file) {

ffmpeg.c:1339:9: 
1337.     /* this is executed just the first time do_video_stats is called */
1338.     if (!vstats_file) {
1339.         vstats_file = fopen(vstats_filename, "w");
              ^
1340.         if (!vstats_file) {
1341.             perror("fopen");

ffmpeg.c:1340:14: Taking true branch
1338.     if (!vstats_file) {
1339.         vstats_file = fopen(vstats_filename, "w");
1340.         if (!vstats_file) {
                   ^
1341.             perror("fopen");
1342.             ffmpeg_exit(1);

ffmpeg.c:1341:13: 
1339.         vstats_file = fopen(vstats_filename, "w");
1340.         if (!vstats_file) {
1341.             perror("fopen");
                  ^
1342.             ffmpeg_exit(1);
1343.         }

ffmpeg.c:1342:13: Skipping ffmpeg_exit(): empty list of specs
1340.         if (!vstats_file) {
1341.             perror("fopen");
1342.             ffmpeg_exit(1);
                  ^
1343.         }
1344.     }

ffmpeg.c:1346:5: 
1344.     }
1345. 
1346.     enc = ost->st->codec;
          ^
1347.     if (enc->codec_type == AVMEDIA_TYPE_VIDEO) {
1348.         frame_number = ost->frame_number;

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

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

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