> On Jul 9, 2017, at 7:26 PM, Dave Rice <d...@dericed.com> wrote: > > >> On Jul 7, 2017, at 7:06 PM, Derek Buitenhuis <derek.buitenh...@gmail.com> >> wrote: >> >> On 7/7/2017 10:13 PM, James Almer wrote: >>> Isn't this necessary only for files with raw video? As is, this box >>> would be written on any mov file with a video stream. >> >> This was addressed a previous email: >> >> http://lists.ffmpeg.org/pipermail/ffmpeg-devel/2017-July/213350.html >> >> I guess the spec is up for interpretation. > > The quicktime spec says "This is a mandatory extension for all uncompressed > Y´CbCr data formats”. It doesn’t clarify if the clap atom is recommended or > not in mov files that are not “uncompressed Y´CbCr”, though it would make > sense if the video container needs to store cropping data. I think > constraining the change for only “uncompressed Y´CbCr” would be more > cautious though. I’ll revise my patch to include the condition and resubmit. > > If the patch only impacts “uncompressed Y´CbCr” would any fate updates be > needed? > Dave Rice
Here’s an update to only write the clap atom for the specific uncompressed encodings listed in TN2162. From 37457c1ee135f39452b91b047af4adf1ec43464b Mon Sep 17 00:00:00 2001 From: Dave Rice <d...@dericed.com> Date: Thu, 16 Nov 2017 11:29:06 -0500 Subject: [PATCH] avformat/movenc: write clap atom for uncompressed yuv in mov fixes 6145 --- libavformat/movenc.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/libavformat/movenc.c b/libavformat/movenc.c index cc3fc19d9b..18232e8ba3 100644 --- a/libavformat/movenc.c +++ b/libavformat/movenc.c @@ -1686,6 +1686,21 @@ static int mov_write_sv3d_tag(AVFormatContext *s, AVIOContext *pb, AVSphericalMa return update_size(pb, sv3d_pos); } +static int mov_write_clap_tag(AVIOContext *pb, MOVTrack *track) +{ + avio_wb32(pb, 40); + ffio_wfourcc(pb, "clap"); + avio_wb32(pb, track->par->width); /* apertureWidth_N */ + avio_wb32(pb, 1); /* apertureWidth_D (= 1) */ + avio_wb32(pb, track->height); /* apertureHeight_N */ + avio_wb32(pb, 1); /* apertureHeight_D (= 1) */ + avio_wb32(pb, 0); /* horizOff_N (= 0) */ + avio_wb32(pb, 1); /* horizOff_D (= 1) */ + avio_wb32(pb, 0); /* vertOff_N (= 0) */ + avio_wb32(pb, 1); /* vertOff_D (= 1) */ + return 40; +} + static int mov_write_pasp_tag(AVIOContext *pb, MOVTrack *track) { AVRational sar; @@ -1970,6 +1985,16 @@ static int mov_write_video_tag(AVIOContext *pb, MOVMuxContext *mov, MOVTrack *tr mov_write_pasp_tag(pb, track); } + int uncompressed_ycbcr = ((track->par->codec_id == AV_CODEC_ID_RAWVIDEO && track->par->format == AV_PIX_FMT_UYVY422) + || (track->par->codec_id == AV_CODEC_ID_RAWVIDEO && track->par->format == AV_PIX_FMT_YUYV422) + || track->par->codec_id == AV_CODEC_ID_V308 + || track->par->codec_id == AV_CODEC_ID_V408 + || track->par->codec_id == AV_CODEC_ID_V410 + || track->par->codec_id == AV_CODEC_ID_V210); + if (uncompressed_ycbcr){ + mov_write_clap_tag(pb, track); + } + if (mov->encryption_scheme != MOV_ENC_NONE) { ff_mov_cenc_write_sinf_tag(track, pb, mov->encryption_kid); } -- 2.15.0 _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel