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

Thierry Foucu tfoucu at gmail.com
Thu Nov 29 07:15:22 CET 2012


On Wed, Nov 28, 2012 at 7:26 PM, Michael Niedermayer <michaelni at gmx.at>wrote:

> 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.
>
> how can the 2 problems be reproduced ?
>
>
regarding the duplicate last frame in the stats_out:
here is a simple command line

-i /tmp/new_universal.flv -passlogfile "/tmp/passlog

-i /tmp/new_universal.flv -passlogfile "/tmp/passlog

ffmpeg  -i /tmp/new_universal.flv -passlogfile "/tmp/passlog" -vcodec
mpeg4 -pass 1 -y /t


ffmpeg -i test.ts -passlogfile "/tmp/passlog" -vcodec mpeg4 -pass 1 -y
/tmp/test.mp4

check the file /tmp/passlog-0.log
and the last line contains a duplicate entry for the last frame:
like this:

in:292 out:292 type:2 q:3433 itex:0 ptex:0 mv:0 misc:1681 fcode:1
bcode:1 mc-var:1200 var:2400 icount:0 skipcount:1200 hbits:55;
in:293 out:293 type:2 q:3429 itex:0 ptex:0 mv:0 misc:1681 fcode:1
bcode:1 mc-var:1200 var:2400 icount:0 skipcount:1200 hbits:55;
in:294 out:294 type:2 q:3250 itex:0 ptex:0 mv:0 misc:1681 fcode:1
bcode:1 mc-var:1200 var:2400 icount:0 skipcount:1200 hbits:55;
in:294 out:294 type:2 q:3250 itex:0 ptex:0 mv:0 misc:1681 fcode:1
bcode:1 mc-var:1200 var:2400 icount:0 skipcount:1200 hbits:55;

in:292 out:292 type:2 q:3433 itex:0 ptex:0 mv:0 misc:1681 fcode:1 bcode:1
mc-var:1200 var:2400 icount:0 skipcount:1200 hbits:55;
in:293 out:293 type:2 q:3429 itex:0 ptex:0 mv:0 misc:1681 fcode:1 bcode:1
mc-var:1200 var:2400 icount:0 skipcount:1200 hbits:55;
in:294 out:294 type:2 q:3250 itex:0 ptex:0 mv:0 misc:1681 fcode:1 bcode:1
mc-var:1200 var:2400 icount:0 skipcount:1200 hbits:55;
in:294 out:294 type:2 q:3250 itex:0 ptex:0 mv:0 misc:1681 fcode:1 bcode:1
mc-var:1200 var:2400 icount:0 skipcount:1200 hbits:55;

in:292 out:292 type:2 q:3433 itex:0 ptex:0 mv:0 misc:1681 fcode:1
bcode:1 mc-var:1200 var:2400 icount:0 skipcount:1200 hbits:55;
in:293 out:293 type:2 q:3429 itex:0 ptex:0 mv:0 misc:1681 fcode:1
bcode:1 mc-var:1200 var:2400 icount:0 skipcount:1200 hbits:55;
in:294 out:294 type:2 q:3250 itex:0 ptex:0 mv:0 misc:1681 fcode:1
bcode:1 mc-var:1200 var:2400 icount:0 skipcount:1200 hbits:55;
in:294 out:294 type:2 q:3250 itex:0 ptex:0 mv:0 misc:1681 fcode:1
bcode:1 mc-var:1200 var:2400 icount:0 skipcount:1200 hbits:55;


regarding the flush, just something like that should do:

ffmpeg  -i /tmp/new_universal.flv -vstats_file "/tmp/passlog" -vcodec
libx264 -y /tmp/test.flv

ffmpeg -i test.ts -vstats_file "/tmp/log" -vcodec libx264 -y /tmp/test.flv

If you know exactly the number of frames you have in the input file, the
/tmp/log file should contain the same number of frames information (just
doing a
but without this patch, you will not get them as when we flush the encoder
(like libx264) we do not account for those frames and the vstats log file
will not have any information about the buffers frames.

even with this patch, when i run this command:
ffmpeg  -i /tmp/new.flv -passlogfile "/tmp/passlog" -vstats_file "/tmp/log"
-vcodec mpeg4 -pass 1 -y /tmp/test.mp4

the number of line in /tmp/passlog may not match the /tmp/log. sometime we
are off by 1 extra frame information in the pass log file.


> [...]
> --
> Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
>
> It is what and why we do it that matters, not just one of them.
>
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
>


More information about the ffmpeg-devel mailing list