Opened 2 weeks ago

Closed 13 days ago

Last modified 6 days ago

#6575 closed enhancement (worksforme)

Bitrate Atom MP4 enhancement

Reported by: Mista_D Owned by:
Priority: important Component: avformat
Version: git-master Keywords: btrt moov mp4 mov
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no


Missing btrt atom in MP4 files:

FFmpeg currently doesn't store average bitrate, max bitrate and buffer size in MP4 MOOV. Would be great to keep this info in MP4 for streaming purposes

ISO-14496 part15 page 20:

Change History (7)

comment:2 Changed 2 weeks ago by Mista_D

Bounty of €250 ($300 USD) to whomever implements it before August 14, 2017 please.

Some work was already done before it seems...

Thank you

comment:3 Changed 2 weeks ago by oscord

@line 1077

+static int mov_write_btrt_tag(AVIOContext *pb, MOVTrack *track)
+ AVCPBProperties *props;
+ int64_t pos = avio_tell(pb);
+ unsigned avg_bitrate;
+ props = (AVCPBProperties*)av_stream_get_side_data(track->st, AV_PKT_DATA_CPB_PROPERTIES, NULL);
+ avg_bitrate = compute_avg_bitrate(track);
+ avio_wb32(pb, 0);
+ ffio_wfourcc(pb, "btrt");
+ avio_wb32(pb, props ? props->buffer_size : 0);
+ avio_wb32(pb, props ? FFMAX3(props->max_bitrate, props->avg_bitrate, avg_bitrate) : FFMAX(track->par->bit_rate, avg_bitrate));
+ avio_wb32(pb, avg_bitrate);
+ return update_size(pb, pos);

@line 1939

mov_write_avcc_tag(pb, track);

+ mov_write_btrt_tag(pb, track);

if (track->mode == MODE_IPOD)

Use the cash for something good

comment:4 Changed 2 weeks ago by oscord


comment:5 Changed 2 weeks ago by Mista_D

Its adding some junk into MOOV after btrt. Not working

Thank you for trying though

comment:6 Changed 13 days ago by Mista_D

  • Resolution set to worksforme
  • Status changed from new to closed

Apologies, my file analyzer didn't recognize pasp atom. Your patch is working as intended.

comment:7 Changed 6 days ago by Mista_D

Donated $250 to to help sick kids

Transaction ID 91Y16613BC393983T

Thank you.

Note: See TracTickets for help on using tickets.