[FFmpeg-devel] [PATCH 3/5] avformat/movenc: implement writing of the btrt box

Jan Ekström jeebjp at gmail.com
Mon Sep 21 19:33:35 EEST 2020


On Mon, Sep 21, 2020 at 1:12 PM Martin Storsjö <martin at martin.st> wrote:
>
> On Sun, 20 Sep 2020, Jan Ekström wrote:
>
> > This is utilized by various media ingests to figure out the bit
> > rate of the content you are pushing towards it, so write it by
> > default for video, audio and subtitle tracks. It is only mentioned
> > for timed metadata sample descriptions in QTFF, so limit it only to
> > ISOBMFF (MODE_MP4).
> >
> > Updates the FATE tests which have their results changed due to the
> > 20 extra bytes being written per track.
> > ---
> > libavformat/movenc.c               |  29 ++++++++
> > tests/fate/mov.mak                 |   2 +-
> > tests/ref/fate/binsub-movtextenc   |   2 +-
> > tests/ref/fate/copy-trac3074       |   4 +-
> > tests/ref/fate/movenc              | 102 ++++++++++++++---------------
> > tests/ref/lavf-fate/av1.mp4        |   4 +-
> > tests/ref/lavf-fate/h264.mp4       |   4 +-
> > tests/ref/lavf/mp4                 |  12 ++--
> > tests/ref/vsynth/vsynth1-mpeg4     |   4 +-
> > tests/ref/vsynth/vsynth2-mpeg4     |   4 +-
> > tests/ref/vsynth/vsynth3-mpeg4     |   4 +-
> > tests/ref/vsynth/vsynth_lena-mpeg4 |   4 +-
> > 12 files changed, 102 insertions(+), 73 deletions(-)
>
> Not familiar with the box or its use, but the change looks pretty sensible
> to me.
>

As far as I understand, its most common use cases are to either show a
per-track bit rate in an mp4 file's stats, or to read the incoming
fragmented mp4 stream's bit rate so it can be advertised when HLS/DASH
etc are being generated from it.

> Are there cases where there's really no sensible information about
> bitrates to write, where it would be preferrable to just drop it, instead
> of writing a box with bogus values?
>

Yea, I basically decided that if maxrate, average bit rate and bufsize
are all zero, then the box is absolutely useless and should be
skipped.

Thanks for reviews, I have applied various improvements and will in a
bit post a v2.

Jan


More information about the ffmpeg-devel mailing list