aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2015-02-23 16:43:38 +0100
committerMichael Niedermayer <michaelni@gmx.at>2015-02-28 12:33:44 +0100
commit5ee3a40f1cf86746d62cc75d505db9679703ba2a (patch)
tree58432c93e64f87b3becfa5332c979150ace7b77d
parent888a33c070f1e96b683e13e7b0b6af891428c6c3 (diff)
downloadffmpeg-5ee3a40f1cf86746d62cc75d505db9679703ba2a.tar.gz
ffmpeg: Fix -vstats when coded_frame is not set
There are several encoders which do not set coded_frame Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r--ffmpeg.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/ffmpeg.c b/ffmpeg.c
index c6f3dcdbde..ca8411b9a8 100644
--- a/ffmpeg.c
+++ b/ffmpeg.c
@@ -1182,8 +1182,8 @@ static void do_video_stats(OutputStream *ost, int frame_size)
enc = ost->enc_ctx;
if (enc->codec_type == AVMEDIA_TYPE_VIDEO) {
frame_number = ost->st->nb_frames;
- fprintf(vstats_file, "frame= %5d q= %2.1f ", frame_number, enc->coded_frame->quality / (float)FF_QP2LAMBDA);
- if (enc->flags&CODEC_FLAG_PSNR)
+ fprintf(vstats_file, "frame= %5d q= %2.1f ", frame_number, enc->coded_frame ? enc->coded_frame->quality / (float)FF_QP2LAMBDA : 0);
+ if (enc->coded_frame && (enc->flags&CODEC_FLAG_PSNR))
fprintf(vstats_file, "PSNR= %6.2f ", psnr(enc->coded_frame->error[0] / (enc->width * enc->height * 255.0 * 255.0)));
fprintf(vstats_file,"f_size= %6d ", frame_size);
@@ -1196,7 +1196,7 @@ static void do_video_stats(OutputStream *ost, int frame_size)
avg_bitrate = (double)(ost->data_size * 8) / ti1 / 1000.0;
fprintf(vstats_file, "s_size= %8.0fkB time= %0.3f br= %7.1fkbits/s avg_br= %7.1fkbits/s ",
(double)ost->data_size / 1024, ti1, bitrate, avg_bitrate);
- fprintf(vstats_file, "type= %c\n", av_get_picture_type_char(enc->coded_frame->pict_type));
+ fprintf(vstats_file, "type= %c\n", enc->coded_frame ? av_get_picture_type_char(enc->coded_frame->pict_type) : 'I');
}
}