OSDN Git Service

libavcodec/mpegvideo_enc.c: Fix encoding videos with less frames than the delay of...
authorAlexis Ballier <aballier@gentoo.org>
Fri, 16 Oct 2015 08:42:33 +0000 (10:42 +0200)
committerMichael Niedermayer <michael@niedermayer.cc>
Sun, 18 Oct 2015 09:55:40 +0000 (11:55 +0200)
commit6e8d856ad6d3decfabad83bc169c2e7a16a16b55
tree9ca6d329979e1f8f039d51daa3bcf0307d60c69d
parentfd46d6deac9b29b07c5d255d0c004782c85fdd7d
libavcodec/mpegvideo_enc.c: Fix encoding videos with less frames than the delay of the encoder.

When the encoder is fed with less frames than its delay, the picture list looks like { NULL, NULL, ..., frame, frame, frame }. When flushing the encoder (input frame == NULL), we need to ensure the picture list is shifted enough so that we do not return an empty packet, which would mean the encoder has finished, while it has not encoded any frame.

Before the patch, the command:
'./ffmpeg_g -loglevel debug -f lavfi -i "testsrc=d=0.01" -bf 2 -vcodec mpeg2video out.mxf' prints:

Output stream #0:0 (video): 1 frames encoded; 0 packets muxed (0 bytes);

After:

Output stream #0:0 (video): 1 frames encoded; 1 packets muxed (8058 bytes);

Relates to ticket #4817.

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
libavcodec/mpegvideo_enc.c