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@gmx.at>
This commit is contained in:
Kevin Wheatley 2015-02-16 10:40:36 +00:00 committed by Michael Niedermayer
parent 588361dd26
commit 31c7c0e156
6 changed files with 15 additions and 8 deletions

View File

@ -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

View File

@ -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);
}

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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