From 04bcb539fdd486bf00687f3b15a2d20687328227 Mon Sep 17 00:00:00 2001 From: wm4 Date: Fri, 11 Apr 2014 00:08:32 +0200 Subject: encode: write 2-pass stats only per-packet The stats were retrieved and written on every encode call, instead of every encode call that actually returned a packet. ffmpeg.c also does it this way, so it must be "more correct". Fixes 2-pass encoding. --- video/out/vo_lavc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/video/out/vo_lavc.c b/video/out/vo_lavc.c index 84f09a161f..9617e0f989 100644 --- a/video/out/vo_lavc.c +++ b/video/out/vo_lavc.c @@ -273,7 +273,8 @@ static int encode_video(struct vo *vo, AVFrame *frame, AVPacket *packet) frame->pts * (double) vc->stream->codec->time_base.num / (double) vc->stream->codec->time_base.den, size); - encode_lavc_write_stats(vo->encode_lavc_ctx, vc->stream); + if (got_packet) + encode_lavc_write_stats(vo->encode_lavc_ctx, vc->stream); return size; } } -- cgit v1.2.3