@@ -1068,6 +1068,21 @@ static int get_samples_per_packet(MOVTrack *track)
return first_duration;
}
+static int mov_write_btrt_tag(AVIOContext *pb, MOVTrack *track)
+{
+ int64_t pos = avio_tell(pb);
+ struct mpeg4_bit_rate_values bit_rates = calculate_mpeg4_bit_rates(track);
+
+ avio_wb32(pb, 0); /* size */
+ ffio_wfourcc(pb, "btrt");
+
+ avio_wb32(pb, bit_rates.buffer_size);
+ avio_wb32(pb, bit_rates.max_bit_rate);
+ avio_wb32(pb, bit_rates.avg_bit_rate);
+
+ return update_size(pb, pos);
+}
+
static int mov_write_audio_tag(AVFormatContext *s, AVIOContext *pb, MOVMuxContext *mov, MOVTrack *track)
{
int64_t pos = avio_tell(pb);
@@ -1216,6 +1231,10 @@ static int mov_write_audio_tag(AVFormatContext *s, AVIOContext *pb, MOVMuxContex
return ret;
}
+ if (track->mode == MODE_MP4 &&
+ ((ret = mov_write_btrt_tag(pb, track)) < 0))
+ return ret;
+
ret = update_size(pb, pos);
return ret;
}
@@ -1731,6 +1750,7 @@ static int mov_write_fiel_tag(AVIOContext *pb, MOVTrack *track, int field_order)
static int mov_write_subtitle_tag(AVIOContext *pb, MOVTrack *track)
{
+ int ret = AVERROR_BUG;
int64_t pos = avio_tell(pb);
avio_wb32(pb, 0); /* size */
avio_wl32(pb, track->tag); // store it byteswapped
@@ -1743,6 +1763,10 @@ static int mov_write_subtitle_tag(AVIOContext *pb, MOVTrack *track)
else if (track->par->extradata_size)
avio_write(pb, track->par->extradata, track->par->extradata_size);
+ if (track->mode == MODE_MP4 &&
+ ((ret = mov_write_btrt_tag(pb, track)) < 0))
+ return ret;
+
return update_size(pb, pos);
}
@@ -2046,6 +2070,7 @@ static void find_compressor(char * compressor_name, int len, MOVTrack *track)
static int mov_write_video_tag(AVFormatContext *s, AVIOContext *pb, MOVMuxContext *mov, MOVTrack *track)
{
+ int ret = AVERROR_BUG;
int64_t pos = avio_tell(pb);
char compressor_name[32] = { 0 };
int avid = 0;
@@ -2226,6 +2251,10 @@ static int mov_write_video_tag(AVFormatContext *s, AVIOContext *pb, MOVMuxContex
ff_mov_cenc_write_sinf_tag(track, pb, mov->encryption_kid);
}
+ if (track->mode == MODE_MP4 &&
+ ((ret = mov_write_btrt_tag(pb, track)) < 0))
+ return ret;
+
/* extra padding for avid stsd */
/* https://developer.apple.com/library/mac/documentation/QuickTime/QTFF/QTFFChap2/qtff2.html#//apple_ref/doc/uid/TP40000939-CH204-61112 */
if (avid)
@@ -113,7 +113,7 @@ fate-mov-spherical-mono: CMD = run ffprobe$(PROGSSUF)$(EXESUF) -show_entries str
fate-mov-gpmf-remux: CMD = md5 -i $(TARGET_SAMPLES)/mov/fake-gp-media-with-real-gpmf.mp4 -map 0 -c copy -fflags +bitexact -f mp4
fate-mov-gpmf-remux: CMP = oneline
-fate-mov-gpmf-remux: REF = 8f48e435ee1f6b7e173ea756141eabf3
+fate-mov-gpmf-remux: REF = 6361cf3c2b9e6962c2eafbda138125f4
fate-mov-guess-delay-1: CMD = run ffprobe$(PROGSSUF)$(EXESUF) -show_entries stream=has_b_frames -select_streams v $(TARGET_SAMPLES)/h264/h264_3bf_nopyramid_nobsrestriction.mp4
fate-mov-guess-delay-2: CMD = run ffprobe$(PROGSSUF)$(EXESUF) -show_entries stream=has_b_frames -select_streams v $(TARGET_SAMPLES)/h264/h264_3bf_pyramid_nobsrestriction.mp4
@@ -1 +1 @@
-fc6d07679ac1f718aa50de687924cd97
+d0370a0627d8891c664d2442bfc8ae53
@@ -1,5 +1,5 @@
-f92a201033712bda262f1e071e25544a *tests/data/fate/copy-trac3074.mp4
-333992 tests/data/fate/copy-trac3074.mp4
+620e3ab4ee6241bec55ea2ec4ef42908 *tests/data/fate/copy-trac3074.mp4
+334012 tests/data/fate/copy-trac3074.mp4
#tb 0: 1/48000
#media_type 0: audio
#codec_id 0: eac3
@@ -1,18 +1,18 @@
write_data len 36, time nopts, type header atom ftyp
-write_data len 2389, time nopts, type header atom -
+write_data len 2429, time nopts, type header atom -
write_data len 788, time 1000000, type sync atom moof
write_data len 110, time nopts, type trailer atom -
-5f401347fc3c771b819e2449d69d4861 3323 non-empty-moov
+6f06e338c71468d56580df40ff265066 3363 non-empty-moov
write_data len 36, time nopts, type header atom ftyp
-write_data len 2721, time nopts, type header atom -
+write_data len 2761, time nopts, type header atom -
write_data len 908, time 966667, type sync atom moof
write_data len 110, time nopts, type trailer atom -
-4267feee527adf8cd4f7b36ac0fc0872 3775 non-empty-moov-elst
+5b6e4211a45cd5dac99c8b90752a03d7 3815 non-empty-moov-elst
write_data len 36, time nopts, type header atom ftyp
-write_data len 2629, time nopts, type header atom -
+write_data len 2669, time nopts, type header atom -
write_data len 908, time 1000000, type sync atom moof
write_data len 110, time nopts, type trailer atom -
-44077b9ad45f3e16fafe4e5ada54e9b0 3683 non-empty-moov-no-elst
+e106084014ed245ed7c4a30f1d11a3ac 3723 non-empty-moov-no-elst
write_data len 24, time nopts, type header atom ftyp
write_data len 1171, time nopts, type header atom -
write_data len 728, time 0, type sync atom moof
@@ -22,108 +22,108 @@ write_data len 812, time nopts, type unknown atom -
write_data len 148, time nopts, type trailer atom -
92ce825ff40505ec8676191705adb7e7 4439 ismv
write_data len 36, time nopts, type header atom ftyp
-write_data len 1123, time nopts, type header atom -
+write_data len 1163, time nopts, type header atom -
write_data len 796, time 0, type sync atom moof
write_data len 788, time 1000000, type sync atom moof
write_data len 148, time nopts, type trailer atom -
-08f4b3ad3a3ea224b2ee731476b9056b 2891 empty-moov
+539baae38cc6f613ff0c2df8d51e9be9 2931 empty-moov
write_data len 36, time nopts, type header atom ftyp
-write_data len 1123, time nopts, type header atom -
+write_data len 1163, time nopts, type header atom -
write_data len 1068, time 0, type sync atom moof
write_data len 908, time 1000000, type sync atom moof
write_data len 148, time nopts, type trailer atom -
-d7a2dcb43eb0f95f92669f55fc7adeba 3283 empty-moov-no-elst
+3b6dbe54520e5775462fa0a3c3fd8c13 3323 empty-moov-no-elst
write_data len 36, time nopts, type header atom ftyp
-write_data len 1123, time nopts, type header atom -
+write_data len 1163, time nopts, type header atom -
write_data len 900, time -33333, type sync atom moof
write_data len 908, time 966667, type sync atom moof
write_data len 148, time nopts, type trailer atom -
-ea70ca697306976879be408431c27aee 3115 empty-moov-no-elst-no-adjust
-write_data len 1159, time nopts, type header atom ftyp
+1136349246e80c6b3ccea5683e6cdfb9 3155 empty-moov-no-elst-no-adjust
+write_data len 1199, time nopts, type header atom ftyp
write_data len 796, time 0, type sync atom moof
write_data len 788, time 1000000, type sync atom moof
write_data len 148, time nopts, type trailer atom -
-08f4b3ad3a3ea224b2ee731476b9056b 2891 delay-moov
-write_data len 1231, time nopts, type header atom ftyp
+539baae38cc6f613ff0c2df8d51e9be9 2931 delay-moov
+write_data len 1271, time nopts, type header atom ftyp
write_data len 916, time -33333, type sync atom moof
write_data len 908, time 966667, type sync atom moof
write_data len 148, time nopts, type trailer atom -
-314cc3b6296f4ee583b328a34be50b2f 3203 delay-moov-elst
-write_data len 1195, time nopts, type header atom ftyp
+545a81eb5a560332ae184390416bcb23 3243 delay-moov-elst
+write_data len 1235, time nopts, type header atom ftyp
write_data len 836, time 0, type sync atom moof
write_data len 67, time nopts, type trailer atom -
-95d6f59a7354b0cfe7ce49927baada4e 2098 delay-moov-empty-track
-write_data len 1195, time nopts, type header atom ftyp
+30498161108680e54cbc68a842aa6767 2138 delay-moov-empty-track
+write_data len 1235, time nopts, type header atom ftyp
write_data len 360, time 0, type sync atom moof
write_data len 360, time 1000000, type sync atom moof
write_data len 86, time nopts, type trailer atom -
-8805d72a27b340ea229c16edde78f974 2001 delay-moov-empty-track-flush
+2dffc9aa7fd7f1040905689d0e25809c 2041 delay-moov-empty-track-flush
write_data len 36, time nopts, type header atom ftyp
-write_data len 1123, time nopts, type header atom -
-351ae2c8b6d35d98b4848c309cce6704 1159 empty-moov-header
+write_data len 1163, time nopts, type header atom -
+0485baf483cf46ac9697d9d633f52b71 1199 empty-moov-header
write_data len 796, time 0, type sync atom moof
write_data len 788, time 1000000, type sync atom moof
-289ee982188d66988a374a462b0b5376 1584 empty-moov-content
+bc350b428534ada05e968202bcf850b2 1584 empty-moov-content
write_data len 148, time nopts, type trailer atom -
-write_data len 1159, time nopts, type header atom ftyp
-351ae2c8b6d35d98b4848c309cce6704 1159 delay-moov-header
+write_data len 1199, time nopts, type header atom ftyp
+0485baf483cf46ac9697d9d633f52b71 1199 delay-moov-header
write_data len 796, time 0, type sync atom moof
write_data len 788, time 1000000, type sync atom moof
-289ee982188d66988a374a462b0b5376 1584 delay-moov-content
+bc350b428534ada05e968202bcf850b2 1584 delay-moov-content
write_data len 148, time nopts, type trailer atom -
write_data len 28, time nopts, type header atom -
-write_data len 1123, time nopts, type header atom -
+write_data len 1163, time nopts, type header atom -
write_data len 884, time 0, type sync atom sidx
write_data len 876, time 1000000, type sync atom sidx
c0307f99a2a362205b7e3d65b1066f86 876 empty-moov-second-frag
write_data len 148, time nopts, type trailer atom -
write_data len 28, time nopts, type header atom -
-write_data len 1123, time nopts, type header atom -
+write_data len 1163, time nopts, type header atom -
write_data len 876, time 1000000, type sync atom sidx
c0307f99a2a362205b7e3d65b1066f86 876 empty-moov-second-frag-discont
write_data len 110, time nopts, type trailer atom -
-write_data len 1223, time nopts, type header atom -
+write_data len 1263, time nopts, type header atom -
write_data len 876, time 1000000, type sync atom sidx
c0307f99a2a362205b7e3d65b1066f86 876 delay-moov-second-frag-discont
write_data len 110, time nopts, type trailer atom -
-write_data len 1223, time nopts, type header atom ftyp
-b3811928793ed0749927eb2f7958421c 1223 delay-moov-elst-init
+write_data len 1263, time nopts, type header atom ftyp
+fed277ef2186ee136fb6ca1ad797b70f 1263 delay-moov-elst-init
write_data len 988, time -33333, type sync atom sidx
write_data len 996, time 966667, type sync atom sidx
0df125407c7e81978ce722e0ae4f6f84 996 delay-moov-elst-second-frag
write_data len 148, time nopts, type trailer atom -
-write_data len 1223, time nopts, type header atom ftyp
-b3811928793ed0749927eb2f7958421c 1223 delay-moov-elst-init-discont
+write_data len 1263, time nopts, type header atom ftyp
+fed277ef2186ee136fb6ca1ad797b70f 1263 delay-moov-elst-init-discont
write_data len 996, time 966667, type sync atom sidx
0df125407c7e81978ce722e0ae4f6f84 996 delay-moov-elst-second-frag-discont
write_data len 110, time nopts, type trailer atom -
-write_data len 1223, time nopts, type header atom ftyp
-041ac8efc35a0d023c26d05eedb20403 1223 delay-moov-elst-signal-init
+write_data len 1263, time nopts, type header atom ftyp
+ac84ac1aa9929a2689ac753530bdbf96 1263 delay-moov-elst-signal-init
write_data len 1004, time -33333, type sync atom sidx
write_data len 996, time 966667, type sync atom sidx
5a583d89318827d2569eecbeaa18c238 996 delay-moov-elst-signal-second-frag
write_data len 148, time nopts, type trailer atom -
-write_data len 1223, time nopts, type header atom ftyp
-041ac8efc35a0d023c26d05eedb20403 1223 delay-moov-elst-signal-init-discont
+write_data len 1263, time nopts, type header atom ftyp
+ac84ac1aa9929a2689ac753530bdbf96 1263 delay-moov-elst-signal-init-discont
write_data len 996, time 966667, type sync atom sidx
5a583d89318827d2569eecbeaa18c238 996 delay-moov-elst-signal-second-frag-discont
write_data len 110, time nopts, type trailer atom -
-write_data len 1247, time nopts, type header atom ftyp
-80511a51d1ac9cde62337eed7176ae03 1247 delay-moov-elst-signal-init-discont-largets
+write_data len 1287, time nopts, type header atom ftyp
+881938922cf7ee5eab7348381611d674 1287 delay-moov-elst-signal-init-discont-largets
write_data len 996, time 279621233333, type sync atom sidx
dc695d65e8a0cdafee28acd8a5ccf81a 996 delay-moov-elst-signal-second-frag-discont-largets
write_data len 110, time nopts, type trailer atom -
-write_data len 1223, time nopts, type header atom ftyp
+write_data len 1263, time nopts, type header atom ftyp
write_data len 2572, time -333333, type sync atom sidx
write_data len 996, time 5166667, type sync atom sidx
write_data len 148, time nopts, type trailer atom -
-d37a7eda807912b9ed05ccfe003a9e4f 4939 vfr
-write_data len 1223, time nopts, type header atom ftyp
+339f6ad63711a7abd27ef8fa8be88cf2 4979 vfr
+write_data len 1263, time nopts, type header atom ftyp
write_data len 2572, time -333333, type sync atom sidx
write_data len 996, time 5166667, type sync atom sidx
write_data len 148, time nopts, type trailer atom -
-d37a7eda807912b9ed05ccfe003a9e4f 4939 vfr-noduration
-write_data len 1231, time nopts, type header atom ftyp
+339f6ad63711a7abd27ef8fa8be88cf2 4979 vfr-noduration
+write_data len 1271, time nopts, type header atom ftyp
write_data len 1500, time -333333, type sync atom moof
write_data len 1500, time nopts, type unknown atom -
write_data len 916, time nopts, type unknown atom -
@@ -131,23 +131,23 @@ write_data len 1500, time 9666667, type sync atom moof
write_data len 1500, time nopts, type unknown atom -
write_data len 1004, time nopts, type unknown atom -
write_data len 148, time nopts, type trailer atom -
-08b6401dc81912e5264245b7233c4ab3 9299 large_frag
-write_data len 1231, time nopts, type header atom ftyp
+c44bf8aa6f06b76dbd55f628166b8ac6 9339 large_frag
+write_data len 1271, time nopts, type header atom ftyp
write_data len 684, time -33333, type sync atom moof
write_data len 504, time 800000, type boundary atom moof
write_data len 420, time 1266667, type boundary atom moof
write_data len 668, time 1566667, type sync atom moof
write_data len 440, time 2233333, type boundary atom moof
write_data len 262, time nopts, type trailer atom -
-a5d087611a9229ba91eb0964cf2f17d9 4209 vfr-noduration-interleave
-write_data len 1231, time nopts, type header atom ftyp
+b94339a6acca52073ae8444cebef439f 4249 vfr-noduration-interleave
+write_data len 1271, time nopts, type header atom ftyp
write_data len 916, time 0, type sync atom moof
write_data len 908, time 1000000, type sync atom moof
write_data len 148, time nopts, type trailer atom -
-d81c3a0ce5940a2db74c99ad435e0560 3203 delay-moov-elst-neg-cts
+901493067b17790fda32722182b575a0 3243 delay-moov-elst-neg-cts
write_data len 36, time nopts, type header atom ftyp
-write_data len 1123, time nopts, type header atom -
+write_data len 1163, time nopts, type header atom -
write_data len 900, time 0, type sync atom moof
write_data len 908, time 1000000, type sync atom moof
write_data len 148, time nopts, type trailer atom -
-3be575022e446855bca1e45b7942cc0c 3115 empty-moov-neg-cts
+fb1a0936066b51b822aeea425a948604 3155 empty-moov-neg-cts
@@ -1,3 +1,3 @@
-1461be24bed65c04aab21659d6e7a3e1 *tests/data/lavf-fate/lavf.av1.mp4
-55956 tests/data/lavf-fate/lavf.av1.mp4
+d6afef355cf1bcf1a71b9cfb98c32fba *tests/data/lavf-fate/lavf.av1.mp4
+55976 tests/data/lavf-fate/lavf.av1.mp4
tests/data/lavf-fate/lavf.av1.mp4 CRC=0x7c27cc15
@@ -1,3 +1,3 @@
-6d158b25efe7391c803f6f61c7a80aa0 *tests/data/lavf-fate/lavf.h264.mp4
-547908 tests/data/lavf-fate/lavf.h264.mp4
+fe299ea5205b71a48281f917b1256a5d *tests/data/lavf-fate/lavf.h264.mp4
+547928 tests/data/lavf-fate/lavf.h264.mp4
tests/data/lavf-fate/lavf.h264.mp4 CRC=0x9da2c999
@@ -1,9 +1,9 @@
-ebca72c186a4f3ba9bb17d9cb5b74fef *tests/data/lavf/lavf.mp4
-312457 tests/data/lavf/lavf.mp4
+71c4ff2e747fe6f8169ff29244fe181d *tests/data/lavf/lavf.mp4
+312477 tests/data/lavf/lavf.mp4
tests/data/lavf/lavf.mp4 CRC=0x9d9a638a
-9944512475d82d2d601f3c96101bdf9c *tests/data/lavf/lavf.mp4
-321343 tests/data/lavf/lavf.mp4
+3c5734ad6d05e4afc2ccefef1385e882 *tests/data/lavf/lavf.mp4
+321363 tests/data/lavf/lavf.mp4
tests/data/lavf/lavf.mp4 CRC=0xe8130120
-7b3e71f294901067046c09f03a426bdc *tests/data/lavf/lavf.mp4
-312001 tests/data/lavf/lavf.mp4
+07348e31d11d92396e1eedc48ea14802 *tests/data/lavf/lavf.mp4
+312021 tests/data/lavf/lavf.mp4
tests/data/lavf/lavf.mp4 CRC=0x9d9a638a
@@ -1,4 +1,4 @@
-b4e8871c504a22c8c874c7e845b73da7 *tests/data/fate/vsynth1-mpeg4.mp4
-540085 tests/data/fate/vsynth1-mpeg4.mp4
+a7e57333c57e0f8a551374b063a41d9e *tests/data/fate/vsynth1-mpeg4.mp4
+540105 tests/data/fate/vsynth1-mpeg4.mp4
f80ec173d37f2f91add031e95579a220 *tests/data/fate/vsynth1-mpeg4.out.rawvideo
stddev: 7.97 PSNR: 30.10 MAXDIFF: 105 bytes: 7603200/ 7603200
@@ -1,4 +1,4 @@
-adbd883d1701beabd04522d003dafab6 *tests/data/fate/vsynth2-mpeg4.mp4
-159310 tests/data/fate/vsynth2-mpeg4.mp4
+b751a2d3b4e693ca39d4fafa0175fc9d *tests/data/fate/vsynth2-mpeg4.mp4
+159330 tests/data/fate/vsynth2-mpeg4.mp4
2645405bc5350acc85ad72f3352f5135 *tests/data/fate/vsynth2-mpeg4.out.rawvideo
stddev: 6.02 PSNR: 32.53 MAXDIFF: 89 bytes: 7603200/ 7603200
@@ -1,4 +1,4 @@
-ddcff996543900496f0b374a2d5cae74 *tests/data/fate/vsynth3-mpeg4.mp4
-26017 tests/data/fate/vsynth3-mpeg4.mp4
+7ca3bbb8bed55d558346d258f5bea440 *tests/data/fate/vsynth3-mpeg4.mp4
+26037 tests/data/fate/vsynth3-mpeg4.mp4
fc0d8c1e58d254031e6207dfcae8f867 *tests/data/fate/vsynth3-mpeg4.out.rawvideo
stddev: 9.66 PSNR: 28.43 MAXDIFF: 79 bytes: 86700/ 86700
@@ -1,4 +1,4 @@
-4a029747434d24d128b078a5e6aa1e88 *tests/data/fate/vsynth_lena-mpeg4.mp4
-119722 tests/data/fate/vsynth_lena-mpeg4.mp4
+a0d0edee19f6658d0e93d294e32a1a6f *tests/data/fate/vsynth_lena-mpeg4.mp4
+119742 tests/data/fate/vsynth_lena-mpeg4.mp4
9a1e085d9e488c5ead0c940c9612a37a *tests/data/fate/vsynth_lena-mpeg4.out.rawvideo
stddev: 5.34 PSNR: 33.57 MAXDIFF: 83 bytes: 7603200/ 7603200