From 0e2fe55fded99bff4f9ec7a01318b864dc1737f6 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 c0b317da94..fcd1d4b487 100644 --- a/video/out/vo_lavc.c +++ b/video/out/vo_lavc.c @@ -267,7 +267,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