[FFmpeg-devel] [PATCH] ffmpeg.c: allow ffmpeg to output stats for each video stream

Wang Cao doubleecao at gmail.com
Thu Jul 12 01:47:45 EEST 2018


>
> This changes the printed values
> ./ffmpeg -i ~/videos/matrixbench_mpeg2.mpg -qscale 2  -vframes 3 -an
> test2.avi
> frame=    3 fps=0.0 q=2.0 Lsize=      51kB time=00:00:00.12
> bitrate=3495.7kbits/s speed=  12x
> video:51kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB
> muxing overhead: 11.128063%
> vs.
> frame=    3 fps=0.0 q=2.0 Lsize=      57kB time=00:00:00.12
> bitrate=3884.7kbits/s speed=11.2x
> video:51kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB
> muxing overhead: 11.128063%
> the file is the same


Thanks for pointing this out! I have noticed the change in the stats but I
think the change is correct. Before my patch, the bitrate calculation is
based on total_size as in

>     oc = output_files[0]->ctx;
>     total_size = avio_size(oc->pb);

If I understand this correctly, the size of whole file will be used to
calculate the bitrate which considers probably header overhead.

I changed it to

> total_size = ost->data_size;

Therefore only the size of the stream under consideration will be used for
calculation.

Please correct me if my understanding is wrong. Thanks!

On Fri, Jun 29, 2018 at 1:58 PM Michael Niedermayer <michael at niedermayer.cc>
wrote:

> On Fri, Jun 22, 2018 at 04:03:38PM +0800, Wang Cao wrote:
> > Make ffmpeg to output stats for each video/audio streams and each ouptut
> file ffmpeg output log in print_report. The report of video/audio sizes is
> clear now as previously all output video/audio sizes were combined to
> report and it is unclear such stats is for one output files or aggregates
> for all output files.
> >
> > Signed-off-by: Wang Cao <wangcao at google.com>
> > ---
> >  fftools/ffmpeg.c | 52 +++++++++++++++++++++++++++++++++---------------
> >  1 file changed, 36 insertions(+), 16 deletions(-)
>
> This changes the printed values
> ./ffmpeg -i ~/videos/matrixbench_mpeg2.mpg -qscale 2  -vframes 3 -an
> test2.avi
>
> frame=    3 fps=0.0 q=2.0 Lsize=      51kB time=00:00:00.12
> bitrate=3495.7kbits/s speed=  12x
> video:51kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB
> muxing overhead: 11.128063%
>
> vs.
>
> frame=    3 fps=0.0 q=2.0 Lsize=      57kB time=00:00:00.12
> bitrate=3884.7kbits/s speed=11.2x
> video:51kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB
> muxing overhead: 11.128063%
>
> the file is the same
>
> [...]
> --
> Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
>
> If a bugfix only changes things apparently unrelated to the bug with no
> further explanation, that is a good sign that the bugfix is wrong.
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>


-- 
Wang Cao


More information about the ffmpeg-devel mailing list