Skip to content

Commit

Permalink
movenc: use similar logic to DASH when writing bit rate to ISML
Browse files Browse the repository at this point in the history
This way, in case of bit rate not being set, max_rate will be used
instead. This enables, for example, remuxing of MPEG-TS to ISMV+ISML
without losing general bit rate information.
  • Loading branch information
jeeb committed Sep 4, 2016
1 parent 8b4e4bc commit 298d88f
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions libavformat/movenc.c
Expand Up @@ -3581,6 +3581,8 @@ static int mov_write_isml_manifest(AVIOContext *pb, MOVMuxContext *mov, AVFormat
{
int64_t pos = avio_tell(pb);
int i;
int64_t manifest_bit_rate = 0;

static const uint8_t uuid[] = {
0xa5, 0xd4, 0x0b, 0x30, 0xe8, 0x14, 0x11, 0xdd,
0xba, 0x2f, 0x08, 0x00, 0x20, 0x0c, 0x9a, 0x66
Expand Down Expand Up @@ -3615,9 +3617,13 @@ static int mov_write_isml_manifest(AVIOContext *pb, MOVMuxContext *mov, AVFormat
} else {
continue;
}

AVCPBProperties *props = (AVCPBProperties*)av_stream_get_side_data(track->st, AV_PKT_DATA_CPB_PROPERTIES, NULL);

manifest_bit_rate = track->par->bit_rate ? track->par->bit_rate : props ? props->max_bitrate : 0;
avio_printf(pb, "<%s systemBitrate=\"%"PRId64"\">\n", type,
(int64_t)track->par->bit_rate);
param_write_int(pb, "systemBitrate", track->par->bit_rate);
(int64_t)manifest_bit_rate);
param_write_int(pb, "systemBitrate", manifest_bit_rate);
param_write_int(pb, "trackID", track_id);
if (track->par->codec_type == AVMEDIA_TYPE_VIDEO) {
if (track->par->codec_id == AV_CODEC_ID_H264) {
Expand Down

0 comments on commit 298d88f

Please sign in to comment.