Only add it when in MOV mode, its in the QT spec This matches libquicktime See: 0216 11:49 Kevin Wheatley ( 38K) [FFmpeg-devel] [PATCH] avformat: Outputting DNxHD into .mov containers 'corrupts' following atoms until end of stsd See: libquicktime/src/stsdtable.c
Signed-off-by: Michael Niedermayer <michae...@gmx.at> --- libavformat/movenc.c | 15 ++++++++++----- tests/ref/vsynth/vsynth1-avui | 4 ++-- tests/ref/vsynth/vsynth1-prores | 4 ++-- tests/ref/vsynth/vsynth1-prores_ks | 4 ++-- tests/ref/vsynth/vsynth1-qtrle | 4 ++-- tests/ref/vsynth/vsynth1-qtrlegray | 4 ++-- tests/ref/vsynth/vsynth1-svq1 | 4 ++-- tests/ref/vsynth/vsynth2-avui | 4 ++-- tests/ref/vsynth/vsynth2-prores | 4 ++-- tests/ref/vsynth/vsynth2-prores_ks | 4 ++-- tests/ref/vsynth/vsynth2-qtrle | 4 ++-- tests/ref/vsynth/vsynth2-qtrlegray | 4 ++-- tests/ref/vsynth/vsynth2-svq1 | 4 ++-- tests/ref/vsynth/vsynth3-prores | 4 ++-- tests/ref/vsynth/vsynth3-prores_ks | 4 ++-- tests/ref/vsynth/vsynth3-qtrle | 4 ++-- tests/ref/vsynth/vsynth3-svq1 | 4 ++-- tests/ref/vsynth/vsynth_lena-avui | 4 ++-- tests/ref/vsynth/vsynth_lena-prores | 4 ++-- tests/ref/vsynth/vsynth_lena-prores_ks | 4 ++-- tests/ref/vsynth/vsynth_lena-qtrle | 4 ++-- tests/ref/vsynth/vsynth_lena-qtrlegray | 4 ++-- tests/ref/vsynth/vsynth_lena-svq1 | 4 ++-- 23 files changed, 54 insertions(+), 49 deletions(-) diff --git a/libavformat/movenc.c b/libavformat/movenc.c index c5b5851..55b147d 100644 --- a/libavformat/movenc.c +++ b/libavformat/movenc.c @@ -1611,7 +1611,7 @@ static int mov_write_video_tag(AVIOContext *pb, MOVMuxContext *mov, MOVTrack *tr { int64_t pos = avio_tell(pb); char compressor_name[32] = { 0 }; - int avid = 0; + int add_terminator = 0; avio_wb32(pb, 0); /* size */ avio_wl32(pb, track->tag); // store it byteswapped @@ -1662,7 +1662,7 @@ static int mov_write_video_tag(AVIOContext *pb, MOVMuxContext *mov, MOVTrack *tr avio_wb32(pb, 0); } else if (track->enc->codec_id == AV_CODEC_ID_DNXHD) { mov_write_avid_tag(pb, track); - avid = 1; + add_terminator = 1; } else if (track->enc->codec_id == AV_CODEC_ID_HEVC) mov_write_hvcc_tag(pb, track); else if (track->enc->codec_id == AV_CODEC_ID_H264 && !TAG_IS_AVCI(track->tag)) { @@ -1684,20 +1684,25 @@ static int mov_write_video_tag(AVIOContext *pb, MOVMuxContext *mov, MOVTrack *tr if (track->enc->codec_id != AV_CODEC_ID_H264 && track->enc->codec_id != AV_CODEC_ID_MPEG4 && track->enc->codec_id != AV_CODEC_ID_DNXHD) - if (track->enc->field_order != AV_FIELD_UNKNOWN) + if (track->enc->field_order != AV_FIELD_UNKNOWN) { mov_write_fiel_tag(pb, track); + add_terminator = 1; + } - if (mov->flags & FF_MOV_FLAG_WRITE_COLR) + if (mov->flags & FF_MOV_FLAG_WRITE_COLR) { mov_write_colr_tag(pb, track); + add_terminator = 1; + } if (track->enc->sample_aspect_ratio.den && track->enc->sample_aspect_ratio.num && track->enc->sample_aspect_ratio.den != track->enc->sample_aspect_ratio.num) { mov_write_pasp_tag(pb, track); + add_terminator = 1; } /* 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) + if (add_terminator && track->mode == MODE_MOV) avio_wb32(pb, 0); return update_size(pb, pos); diff --git a/tests/ref/vsynth/vsynth1-avui b/tests/ref/vsynth/vsynth1-avui index 1f08053..ff094d3 100644 --- a/tests/ref/vsynth/vsynth1-avui +++ b/tests/ref/vsynth/vsynth1-avui @@ -1,4 +1,4 @@ -25ef49e1aee0b20d4feee89b8dc093b4 *tests/data/fate/vsynth1-avui.mov -42625037 tests/data/fate/vsynth1-avui.mov +b45460e127601347105ca4ef6f3669d6 *tests/data/fate/vsynth1-avui.mov +42625041 tests/data/fate/vsynth1-avui.mov c5ccac874dbf808e9088bc3107860042 *tests/data/fate/vsynth1-avui.out.rawvideo stddev: 0.00 PSNR:999.99 MAXDIFF: 0 bytes: 7603200/ 7603200 diff --git a/tests/ref/vsynth/vsynth1-prores b/tests/ref/vsynth/vsynth1-prores index 14de8b9..641b25d 100644 --- a/tests/ref/vsynth/vsynth1-prores +++ b/tests/ref/vsynth/vsynth1-prores @@ -1,4 +1,4 @@ -7ca7d2f9f5d8ac2ead691b1b6a70d409 *tests/data/fate/vsynth1-prores.mov -5022821 tests/data/fate/vsynth1-prores.mov +b3ec0eb568ad8a28c38bd3ee00466efe *tests/data/fate/vsynth1-prores.mov +5022825 tests/data/fate/vsynth1-prores.mov fb4a9e025d12afc0dbbca8d82831858f *tests/data/fate/vsynth1-prores.out.rawvideo stddev: 2.47 PSNR: 40.27 MAXDIFF: 31 bytes: 7603200/ 7603200 diff --git a/tests/ref/vsynth/vsynth1-prores_ks b/tests/ref/vsynth/vsynth1-prores_ks index 6e5ed17..edd8ba9 100644 --- a/tests/ref/vsynth/vsynth1-prores_ks +++ b/tests/ref/vsynth/vsynth1-prores_ks @@ -1,4 +1,4 @@ -fe41a284da97ea5ec8866ca9a55b84da *tests/data/fate/vsynth1-prores_ks.mov -3858911 tests/data/fate/vsynth1-prores_ks.mov +3aa1df500c8fa8fd5afbc7d6c77f9093 *tests/data/fate/vsynth1-prores_ks.mov +3858915 tests/data/fate/vsynth1-prores_ks.mov 100eb002413fe7a632d440dfbdf7e3ff *tests/data/fate/vsynth1-prores_ks.out.rawvideo stddev: 3.17 PSNR: 38.09 MAXDIFF: 39 bytes: 7603200/ 7603200 diff --git a/tests/ref/vsynth/vsynth1-qtrle b/tests/ref/vsynth/vsynth1-qtrle index 4b92081..e0dfa54 100644 --- a/tests/ref/vsynth/vsynth1-qtrle +++ b/tests/ref/vsynth/vsynth1-qtrle @@ -1,4 +1,4 @@ -35d8a1446d886fadcdffae192bed7e4e *tests/data/fate/vsynth1-qtrle.mov -15263158 tests/data/fate/vsynth1-qtrle.mov +c02b5c93df2ad9f60b6f91c6dc64b09b *tests/data/fate/vsynth1-qtrle.mov +15263162 tests/data/fate/vsynth1-qtrle.mov 93695a27c24a61105076ca7b1f010bbd *tests/data/fate/vsynth1-qtrle.out.rawvideo stddev: 3.42 PSNR: 37.44 MAXDIFF: 48 bytes: 7603200/ 7603200 diff --git a/tests/ref/vsynth/vsynth1-qtrlegray b/tests/ref/vsynth/vsynth1-qtrlegray index c3d571d..ec0af77 100644 --- a/tests/ref/vsynth/vsynth1-qtrlegray +++ b/tests/ref/vsynth/vsynth1-qtrlegray @@ -1,4 +1,4 @@ -651b745a37a06ddd52adfe8e0a45b115 *tests/data/fate/vsynth1-qtrlegray.mov -5113293 tests/data/fate/vsynth1-qtrlegray.mov +eb700a4cfa3c7d3342a46c291c30960b *tests/data/fate/vsynth1-qtrlegray.mov +5113297 tests/data/fate/vsynth1-qtrlegray.mov cb20af0e5a65aad7cf47002fcb52288e *tests/data/fate/vsynth1-qtrlegray.out.rawvideo stddev: 25.34 PSNR: 20.05 MAXDIFF: 122 bytes: 7603200/ 7603200 diff --git a/tests/ref/vsynth/vsynth1-svq1 b/tests/ref/vsynth/vsynth1-svq1 index 9c1b6ff..4263b5e 100644 --- a/tests/ref/vsynth/vsynth1-svq1 +++ b/tests/ref/vsynth/vsynth1-svq1 @@ -1,4 +1,4 @@ -a3206831d34197a2d236d82dd0248646 *tests/data/fate/vsynth1-svq1.mov -1334233 tests/data/fate/vsynth1-svq1.mov +9f7ad5a6a7fbd85d261a283a82f67e24 *tests/data/fate/vsynth1-svq1.mov +1334237 tests/data/fate/vsynth1-svq1.mov 9cc35c54b2c77d36bd7e308b393c1f81 *tests/data/fate/vsynth1-svq1.out.rawvideo stddev: 9.58 PSNR: 28.50 MAXDIFF: 210 bytes: 7603200/ 7603200 diff --git a/tests/ref/vsynth/vsynth2-avui b/tests/ref/vsynth/vsynth2-avui index 2423916..f1fb7af 100644 --- a/tests/ref/vsynth/vsynth2-avui +++ b/tests/ref/vsynth/vsynth2-avui @@ -1,4 +1,4 @@ -8f6ab410bb6b5dc4599e12968dbd0366 *tests/data/fate/vsynth2-avui.mov -42625037 tests/data/fate/vsynth2-avui.mov +32af2f31a254041b1a64d3cfd2abf70f *tests/data/fate/vsynth2-avui.mov +42625041 tests/data/fate/vsynth2-avui.mov 36d7ca943916e1743cefa609eba0205c *tests/data/fate/vsynth2-avui.out.rawvideo stddev: 0.00 PSNR:999.99 MAXDIFF: 0 bytes: 7603200/ 7603200 diff --git a/tests/ref/vsynth/vsynth2-prores b/tests/ref/vsynth/vsynth2-prores index a1b4bb7..c4be9cc 100644 --- a/tests/ref/vsynth/vsynth2-prores +++ b/tests/ref/vsynth/vsynth2-prores @@ -1,4 +1,4 @@ -aa57fd1221b7eefaf1f34f9d57d6a7cb *tests/data/fate/vsynth2-prores.mov -3265056 tests/data/fate/vsynth2-prores.mov +592d132054b13d0ff24ccc6d4115bb8a *tests/data/fate/vsynth2-prores.mov +3265060 tests/data/fate/vsynth2-prores.mov 537b0ff66d7c8c3c12faa89d042e6a49 *tests/data/fate/vsynth2-prores.out.rawvideo stddev: 1.38 PSNR: 45.29 MAXDIFF: 12 bytes: 7603200/ 7603200 diff --git a/tests/ref/vsynth/vsynth2-prores_ks b/tests/ref/vsynth/vsynth2-prores_ks index b42e7b3..cf79299 100644 --- a/tests/ref/vsynth/vsynth2-prores_ks +++ b/tests/ref/vsynth/vsynth2-prores_ks @@ -1,4 +1,4 @@ -00c75fc738859e41c48cbe36ad60c2e2 *tests/data/fate/vsynth2-prores_ks.mov -3868162 tests/data/fate/vsynth2-prores_ks.mov +09312464e3bb73e3ccfa24ec5d9dde84 *tests/data/fate/vsynth2-prores_ks.mov +3868166 tests/data/fate/vsynth2-prores_ks.mov fe7ad707205c6100e9a3956d4e1c300e *tests/data/fate/vsynth2-prores_ks.out.rawvideo stddev: 1.17 PSNR: 46.72 MAXDIFF: 14 bytes: 7603200/ 7603200 diff --git a/tests/ref/vsynth/vsynth2-qtrle b/tests/ref/vsynth/vsynth2-qtrle index 4adf913..0793c6d 100644 --- a/tests/ref/vsynth/vsynth2-qtrle +++ b/tests/ref/vsynth/vsynth2-qtrle @@ -1,4 +1,4 @@ -b44d1cd0bb4c1e7c57d668bd9c1d319a *tests/data/fate/vsynth2-qtrle.mov -14035926 tests/data/fate/vsynth2-qtrle.mov +759d5f9ef2d459212019efa6504d4d0a *tests/data/fate/vsynth2-qtrle.mov +14035930 tests/data/fate/vsynth2-qtrle.mov 32fae3e665407bb4317b3f90fedb903c *tests/data/fate/vsynth2-qtrle.out.rawvideo stddev: 1.54 PSNR: 44.37 MAXDIFF: 17 bytes: 7603200/ 7603200 diff --git a/tests/ref/vsynth/vsynth2-qtrlegray b/tests/ref/vsynth/vsynth2-qtrlegray index 824e64b..2edd05b 100644 --- a/tests/ref/vsynth/vsynth2-qtrlegray +++ b/tests/ref/vsynth/vsynth2-qtrlegray @@ -1,4 +1,4 @@ -4910471607743da624ef7339637a33e2 *tests/data/fate/vsynth2-qtrlegray.mov -4988372 tests/data/fate/vsynth2-qtrlegray.mov +3cc8a504056109d3353843d9c2f01ff2 *tests/data/fate/vsynth2-qtrlegray.mov +4988376 tests/data/fate/vsynth2-qtrlegray.mov 510a92a21b552c51fcafab8188982f4d *tests/data/fate/vsynth2-qtrlegray.out.rawvideo stddev: 16.31 PSNR: 23.88 MAXDIFF: 89 bytes: 7603200/ 7603200 diff --git a/tests/ref/vsynth/vsynth2-svq1 b/tests/ref/vsynth/vsynth2-svq1 index 9c7db7f..e601c99 100644 --- a/tests/ref/vsynth/vsynth2-svq1 +++ b/tests/ref/vsynth/vsynth2-svq1 @@ -1,4 +1,4 @@ -c767386f0f6f36b554d278592bc6e9a4 *tests/data/fate/vsynth2-svq1.mov -940289 tests/data/fate/vsynth2-svq1.mov +94d80d1519e47928666a48eeeb304b6e *tests/data/fate/vsynth2-svq1.mov +940293 tests/data/fate/vsynth2-svq1.mov a8cd3b833cd7f570ddbf1e6b3eb125b6 *tests/data/fate/vsynth2-svq1.out.rawvideo stddev: 3.71 PSNR: 36.72 MAXDIFF: 210 bytes: 7603200/ 7603200 diff --git a/tests/ref/vsynth/vsynth3-prores b/tests/ref/vsynth/vsynth3-prores index f63a7a7..61c3687 100644 --- a/tests/ref/vsynth/vsynth3-prores +++ b/tests/ref/vsynth/vsynth3-prores @@ -1,4 +1,4 @@ -b060c59be88b4b089ece5ee8dc4f1c58 *tests/data/fate/vsynth3-prores.mov -105367 tests/data/fate/vsynth3-prores.mov +76310d00bb2a7b019838ae7200083ad2 *tests/data/fate/vsynth3-prores.mov +105371 tests/data/fate/vsynth3-prores.mov fff5e7ad21d78501c8fa4749bf4bf289 *tests/data/fate/vsynth3-prores.out.rawvideo stddev: 2.80 PSNR: 39.17 MAXDIFF: 27 bytes: 86700/ 86700 diff --git a/tests/ref/vsynth/vsynth3-prores_ks b/tests/ref/vsynth/vsynth3-prores_ks index 99cfc13..dfdffe9 100644 --- a/tests/ref/vsynth/vsynth3-prores_ks +++ b/tests/ref/vsynth/vsynth3-prores_ks @@ -1,4 +1,4 @@ -7ceff8c9cffca766f8a167ba73dad0e2 *tests/data/fate/vsynth3-prores_ks.mov -95053 tests/data/fate/vsynth3-prores_ks.mov +23a7a639e54ef6d5015b309473267698 *tests/data/fate/vsynth3-prores_ks.mov +95057 tests/data/fate/vsynth3-prores_ks.mov 9ab6d3e3cc7749796cd9fa984c60d890 *tests/data/fate/vsynth3-prores_ks.out.rawvideo stddev: 4.09 PSNR: 35.88 MAXDIFF: 35 bytes: 86700/ 86700 diff --git a/tests/ref/vsynth/vsynth3-qtrle b/tests/ref/vsynth/vsynth3-qtrle index 6f93232..0e7ffa2 100644 --- a/tests/ref/vsynth/vsynth3-qtrle +++ b/tests/ref/vsynth/vsynth3-qtrle @@ -1,4 +1,4 @@ -33ec7d4f0a18fcf6da3bdacb494e2035 *tests/data/fate/vsynth3-qtrle.mov -179656 tests/data/fate/vsynth3-qtrle.mov +7cb0186bfb14767c2e2091edcc19a279 *tests/data/fate/vsynth3-qtrle.mov +179660 tests/data/fate/vsynth3-qtrle.mov 693aff10c094f8bd31693f74cf79d2b2 *tests/data/fate/vsynth3-qtrle.out.rawvideo stddev: 3.67 PSNR: 36.82 MAXDIFF: 43 bytes: 86700/ 86700 diff --git a/tests/ref/vsynth/vsynth3-svq1 b/tests/ref/vsynth/vsynth3-svq1 index b51fa03..c3be176 100644 --- a/tests/ref/vsynth/vsynth3-svq1 +++ b/tests/ref/vsynth/vsynth3-svq1 @@ -1,4 +1,4 @@ -1eaf318269afd7426406d73397c39a48 *tests/data/fate/vsynth3-svq1.mov -40773 tests/data/fate/vsynth3-svq1.mov +ad41f125a77e48530f5b6653bf7b9644 *tests/data/fate/vsynth3-svq1.mov +40777 tests/data/fate/vsynth3-svq1.mov a1e5334cf67649bf8c7d95dc4d1bf148 *tests/data/fate/vsynth3-svq1.out.rawvideo stddev: 14.49 PSNR: 24.91 MAXDIFF: 183 bytes: 86700/ 86700 diff --git a/tests/ref/vsynth/vsynth_lena-avui b/tests/ref/vsynth/vsynth_lena-avui index c2fced8..b52f88a 100644 --- a/tests/ref/vsynth/vsynth_lena-avui +++ b/tests/ref/vsynth/vsynth_lena-avui @@ -1,4 +1,4 @@ -26805e15d9e732cd24aea91ae564d5c3 *tests/data/fate/vsynth_lena-avui.mov -42625037 tests/data/fate/vsynth_lena-avui.mov +4e07553edd25a65ff32298f1d1cde61d *tests/data/fate/vsynth_lena-avui.mov +42625041 tests/data/fate/vsynth_lena-avui.mov dde5895817ad9d219f79a52d0bdfb001 *tests/data/fate/vsynth_lena-avui.out.rawvideo stddev: 0.00 PSNR:999.99 MAXDIFF: 0 bytes: 7603200/ 7603200 diff --git a/tests/ref/vsynth/vsynth_lena-prores b/tests/ref/vsynth/vsynth_lena-prores index 5b8c3fe..ffb1eb9 100644 --- a/tests/ref/vsynth/vsynth_lena-prores +++ b/tests/ref/vsynth/vsynth_lena-prores @@ -1,4 +1,4 @@ -637f34b5fd81f072f76a967595fa6af7 *tests/data/fate/vsynth_lena-prores.mov -2844076 tests/data/fate/vsynth_lena-prores.mov +01909f71b6ffb899e663900889b8ff19 *tests/data/fate/vsynth_lena-prores.mov +2844080 tests/data/fate/vsynth_lena-prores.mov 03fd29e3963716a09d232b6f817ecb57 *tests/data/fate/vsynth_lena-prores.out.rawvideo stddev: 1.31 PSNR: 45.77 MAXDIFF: 11 bytes: 7603200/ 7603200 diff --git a/tests/ref/vsynth/vsynth_lena-prores_ks b/tests/ref/vsynth/vsynth_lena-prores_ks index 0cdfa9b..f991416 100644 --- a/tests/ref/vsynth/vsynth_lena-prores_ks +++ b/tests/ref/vsynth/vsynth_lena-prores_ks @@ -1,4 +1,4 @@ -b03741c69037cbdcd2809278c00c0350 *tests/data/fate/vsynth_lena-prores_ks.mov -3884596 tests/data/fate/vsynth_lena-prores_ks.mov +476a413c2f7a36289632c045e410f131 *tests/data/fate/vsynth_lena-prores_ks.mov +3884600 tests/data/fate/vsynth_lena-prores_ks.mov 6cfe987de99cf8ac9d43bdc5cd150838 *tests/data/fate/vsynth_lena-prores_ks.out.rawvideo stddev: 0.92 PSNR: 48.78 MAXDIFF: 10 bytes: 7603200/ 7603200 diff --git a/tests/ref/vsynth/vsynth_lena-qtrle b/tests/ref/vsynth/vsynth_lena-qtrle index 9ce6abe..e4f2d76 100644 --- a/tests/ref/vsynth/vsynth_lena-qtrle +++ b/tests/ref/vsynth/vsynth_lena-qtrle @@ -1,4 +1,4 @@ -4863978263d966d704ffaaa6d23123bb *tests/data/fate/vsynth_lena-qtrle.mov -14798345 tests/data/fate/vsynth_lena-qtrle.mov +f6195088612567a9c1e68870bf21d559 *tests/data/fate/vsynth_lena-qtrle.mov +14798349 tests/data/fate/vsynth_lena-qtrle.mov 98d0e2854731472c5bf13d8638502d0a *tests/data/fate/vsynth_lena-qtrle.out.rawvideo stddev: 1.26 PSNR: 46.10 MAXDIFF: 13 bytes: 7603200/ 7603200 diff --git a/tests/ref/vsynth/vsynth_lena-qtrlegray b/tests/ref/vsynth/vsynth_lena-qtrlegray index 951e7a7..91eaa72 100644 --- a/tests/ref/vsynth/vsynth_lena-qtrlegray +++ b/tests/ref/vsynth/vsynth_lena-qtrlegray @@ -1,4 +1,4 @@ -2c4e69b59d8e8e19903c843575806d5f *tests/data/fate/vsynth_lena-qtrlegray.mov -5111283 tests/data/fate/vsynth_lena-qtrlegray.mov +c97b29ef2b693442c4f45d0a4d858995 *tests/data/fate/vsynth_lena-qtrlegray.mov +5111287 tests/data/fate/vsynth_lena-qtrlegray.mov d7bfbe259af9ae323bb94b09c33570a5 *tests/data/fate/vsynth_lena-qtrlegray.out.rawvideo stddev: 18.65 PSNR: 22.72 MAXDIFF: 72 bytes: 7603200/ 7603200 diff --git a/tests/ref/vsynth/vsynth_lena-svq1 b/tests/ref/vsynth/vsynth_lena-svq1 index 1558c50..63ecfe0 100644 --- a/tests/ref/vsynth/vsynth_lena-svq1 +++ b/tests/ref/vsynth/vsynth_lena-svq1 @@ -1,4 +1,4 @@ -6e9678439ab7460db1fcc8e41ca1a1e0 *tests/data/fate/vsynth_lena-svq1.mov -766701 tests/data/fate/vsynth_lena-svq1.mov +01fe07f19fd959779c6ca39a3d5bc2e3 *tests/data/fate/vsynth_lena-svq1.mov +766705 tests/data/fate/vsynth_lena-svq1.mov aa03471dac3f49455a33a2b19fda1098 *tests/data/fate/vsynth_lena-svq1.out.rawvideo stddev: 3.23 PSNR: 37.93 MAXDIFF: 61 bytes: 7603200/ 7603200 -- 1.7.9.5 _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel