[FFmpeg-devel] [PATCH 1/1] [PATCH] don't duplicate the last frame twice in passlog

Reimar Döffinger Reimar.Doeffinger at gmx.de
Wed Nov 28 22:33:14 CET 2012


On Wed, Nov 28, 2012 at 01:23:47PM -0800, Thierry Foucu wrote:
> Some codec will duplicate the last frame because stats_out is not updated,
> and the last "frame" will had got_packet=0 to signal EOF
> 
> And update video stats log during encode flush.
> ---
>  ffmpeg.c |    7 +++++++
>  1 files changed, 7 insertions(+), 0 deletions(-)
> 
> diff --git a/ffmpeg.c b/ffmpeg.c
> index 55b5f86..ed6696e 100644
> --- a/ffmpeg.c
> +++ b/ffmpeg.c
> @@ -920,6 +920,7 @@ static void do_video_out(AVFormatContext *s,
>              /* if two pass, output log */
>              if (ost->logfile && enc->stats_out) {
>                  fprintf(ost->logfile, "%s", enc->stats_out);
> +                enc->stats_out[0] = '\0';

If we did this wrong there are certainly lots of other users of
libavcodec that have the same issue.
Thus it should be solved somewhere in libavcodec (e.g.
at the start of avcodec_encode_video2), not in FFmpeg.c.
Even more so since I think applications preferably shouldn't assume
that stats_out can be modified without causing issues.


More information about the ffmpeg-devel mailing list