[FFmpeg-devel] [PATCH 1/3] movenc: use similar logic to DASH when writing bit rate to ISML

Jan Ekström jeebjp at gmail.com
Sat Mar 19 18:39:05 CET 2016


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.
---
 libavformat/movenc.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/libavformat/movenc.c b/libavformat/movenc.c
index 9af44e3..16b044a 100644
--- a/libavformat/movenc.c
+++ b/libavformat/movenc.c
@@ -3323,6 +3323,8 @@ static int mov_write_isml_manifest(AVIOContext *pb, MOVMuxContext *mov)
 {
     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
@@ -3356,9 +3358,11 @@ static int mov_write_isml_manifest(AVIOContext *pb, MOVMuxContext *mov)
         } else {
             continue;
         }
+
+        manifest_bit_rate = track->enc->bit_rate ? track->enc->bit_rate : track->enc->rc_max_rate;
         avio_printf(pb, "<%s systemBitrate=\"%"PRId64"\">\n", type,
-                    (int64_t)track->enc->bit_rate);
-        param_write_int(pb, "systemBitrate", track->enc->bit_rate);
+                    (int64_t)manifest_bit_rate);
+        param_write_int(pb, "systemBitrate", manifest_bit_rate);
         param_write_int(pb, "trackID", track_id);
         if (track->enc->codec_type == AVMEDIA_TYPE_VIDEO) {
             if (track->enc->codec_id == AV_CODEC_ID_H264) {
-- 
2.5.0



More information about the ffmpeg-devel mailing list