[FFmpeg-cvslog] avformat/movenc: Move avid DNxHD padding to the correct spot
Kevin Wheatley
git at videolan.org
Fri Feb 20 12:27:21 CET 2015
ffmpeg | branch: master | Kevin Wheatley <kevin.j.wheatley at gmail.com> | Mon Feb 16 10:40:36 2015 +0000| [31c7c0e156975be615479948824c1528952c0731] | committer: Michael Niedermayer
avformat/movenc: Move avid DNxHD padding to the correct spot
Outputting DNxHD into .mov containers 'corrupts' following atoms until end of stsd
ffmpeg and qtdump could not decode pasp/colr atoms in the files made by ffmpeg,
when outputting DNxHD due to the incorrect padding placement. Now we add the
padding in the correct place
Tidy up FATE changes due to padding changes.
Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=31c7c0e156975be615479948824c1528952c0731
---
Changelog | 2 ++
libavformat/movenc.c | 13 +++++++++----
tests/ref/vsynth/vsynth1-dnxhd-1080i-colr | 2 +-
tests/ref/vsynth/vsynth2-dnxhd-1080i-colr | 2 +-
tests/ref/vsynth/vsynth3-dnxhd-1080i-colr | 2 +-
tests/ref/vsynth/vsynth_lena-dnxhd-1080i-colr | 2 +-
6 files changed, 15 insertions(+), 8 deletions(-)
diff --git a/Changelog b/Changelog
index 65d9287..d459e22 100644
--- a/Changelog
+++ b/Changelog
@@ -32,6 +32,8 @@ version <next>:
- AAC ELD 480 decoding
- Intel QSV-accelerated H.264 decoding
- DSS SP decoder and DSS demuxer
+- Fix stsd atom corruption in DNxHD QuickTimes
+
version 2.5:
- HEVC/H.265 RTP payload format (draft v6) packetizer
diff --git a/libavformat/movenc.c b/libavformat/movenc.c
index 5e172cb..a72f84e 100644
--- a/libavformat/movenc.c
+++ b/libavformat/movenc.c
@@ -1077,8 +1077,6 @@ static int mov_write_avid_tag(AVIOContext *pb, MOVTrack *track)
for (i = 0; i < 10; i++)
avio_wb64(pb, 0);
- /* extra padding for stsd needed */
- avio_wb32(pb, 0);
return 0;
}
@@ -1592,6 +1590,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;
avio_wb32(pb, 0); /* size */
avio_wl32(pb, track->tag); // store it byteswapped
@@ -1640,9 +1639,10 @@ static int mov_write_video_tag(AVIOContext *pb, MOVMuxContext *mov, MOVTrack *tr
track->enc->codec_id == AV_CODEC_ID_SVQ3) {
mov_write_extradata_tag(pb, track);
avio_wb32(pb, 0);
- } else if (track->enc->codec_id == AV_CODEC_ID_DNXHD)
+ } else if (track->enc->codec_id == AV_CODEC_ID_DNXHD) {
mov_write_avid_tag(pb, track);
- else if (track->enc->codec_id == AV_CODEC_ID_HEVC)
+ avid = 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)) {
mov_write_avcc_tag(pb, track);
@@ -1674,6 +1674,11 @@ static int mov_write_video_tag(AVIOContext *pb, MOVMuxContext *mov, MOVTrack *tr
mov_write_pasp_tag(pb, track);
}
+ /* 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)
+ avio_wb32(pb, 0);
+
return update_size(pb, pos);
}
diff --git a/tests/ref/vsynth/vsynth1-dnxhd-1080i-colr b/tests/ref/vsynth/vsynth1-dnxhd-1080i-colr
index ee21e96..16d8953 100644
--- a/tests/ref/vsynth/vsynth1-dnxhd-1080i-colr
+++ b/tests/ref/vsynth/vsynth1-dnxhd-1080i-colr
@@ -1,4 +1,4 @@
-200a881696cc70c36c33fb415ed9488b *tests/data/fate/vsynth1-dnxhd-1080i-colr.mov
+5fccdb16c0f14dea1b6b603bac90b97e *tests/data/fate/vsynth1-dnxhd-1080i-colr.mov
3031929 tests/data/fate/vsynth1-dnxhd-1080i-colr.mov
5835dff88cb84e83bbe70b5ed5edd5ab *tests/data/fate/vsynth1-dnxhd-1080i-colr.out.rawvideo
stddev: 5.79 PSNR: 32.87 MAXDIFF: 56 bytes: 7603200/ 760320
diff --git a/tests/ref/vsynth/vsynth2-dnxhd-1080i-colr b/tests/ref/vsynth/vsynth2-dnxhd-1080i-colr
index d41b5b3..ba5e6a1 100644
--- a/tests/ref/vsynth/vsynth2-dnxhd-1080i-colr
+++ b/tests/ref/vsynth/vsynth2-dnxhd-1080i-colr
@@ -1,4 +1,4 @@
-53dfdc17882f2240a10c799287bf4b68 *tests/data/fate/vsynth2-dnxhd-1080i-colr.mov
+f9827e9867b0ea4f7585d8e362a58413 *tests/data/fate/vsynth2-dnxhd-1080i-colr.mov
3031929 tests/data/fate/vsynth2-dnxhd-1080i-colr.mov
e4cf5528c993b5e7d57a9d0a4d2cd0c6 *tests/data/fate/vsynth2-dnxhd-1080i-colr.out.rawvideo
stddev: 1.58 PSNR: 44.15 MAXDIFF: 33 bytes: 7603200/ 760320
diff --git a/tests/ref/vsynth/vsynth3-dnxhd-1080i-colr b/tests/ref/vsynth/vsynth3-dnxhd-1080i-colr
index 2c5084c..7cc2298 100644
--- a/tests/ref/vsynth/vsynth3-dnxhd-1080i-colr
+++ b/tests/ref/vsynth/vsynth3-dnxhd-1080i-colr
@@ -1,4 +1,4 @@
-da84414ce38ed0479c61a493398c912a *tests/data/fate/vsynth3-dnxhd-1080i-colr.mov
+ee7a70832f37793b62642f770d988bdb *tests/data/fate/vsynth3-dnxhd-1080i-colr.mov
3031929 tests/data/fate/vsynth3-dnxhd-1080i-colr.mov
7dd6b261e439cda21df4f01b45336b41 *tests/data/fate/vsynth3-dnxhd-1080i-colr.out.rawvideo
stddev: 6.92 PSNR: 31.32 MAXDIFF: 50 bytes: 86700/ 8670
diff --git a/tests/ref/vsynth/vsynth_lena-dnxhd-1080i-colr b/tests/ref/vsynth/vsynth_lena-dnxhd-1080i-colr
index 2f40f9b..1889786 100644
--- a/tests/ref/vsynth/vsynth_lena-dnxhd-1080i-colr
+++ b/tests/ref/vsynth/vsynth_lena-dnxhd-1080i-colr
@@ -1,4 +1,4 @@
-241d5c03c5f6d7560b9e164ce0617f04 *tests/data/fate/vsynth_lena-dnxhd-1080i-colr.mov
+5ba3ddb58b10e5f0069cb4f82d594695 *tests/data/fate/vsynth_lena-dnxhd-1080i-colr.mov
3031929 tests/data/fate/vsynth_lena-dnxhd-1080i-colr.mov
864c3d5f49d9edf66ce8f82a2a6725f6 *tests/data/fate/vsynth_lena-dnxhd-1080i-colr.out.rawvideo
stddev: 1.36 PSNR: 45.45 MAXDIFF: 22 bytes: 7603200/ 760320
More information about the ffmpeg-cvslog
mailing list