From patchwork Thu Nov 16 17:14:30 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Dave Rice X-Patchwork-Id: 6121 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.2.161.94 with SMTP id m30csp6066202jah; Thu, 16 Nov 2017 09:15:01 -0800 (PST) X-Google-Smtp-Source: AGs4zMbaVnn06me6xo7zzt5NmMj9PEgi6zql1MsHTqEwNCxtX/jB0CwygJtoO/Robtg6oFRwQSb+ X-Received: by 10.28.229.19 with SMTP id c19mr1895382wmh.156.1510852501685; Thu, 16 Nov 2017 09:15:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1510852501; cv=none; d=google.com; s=arc-20160816; b=gJh4uhGXh+7puO78AqEW8Mk3lQlO12ApN8fKZtznqU56IZi3Q67u4WG45lDI2BiGu6 t2CuERRNoSnYO0y/r9OK0eW4Tgf/jKcK2wn74iXhJrV0TW4UicDfq9oIUHE9k5E2qjH+ 27+m537viQ/7ZERAmzLlzJ8jlGuCSl+oZjY8/Tx3oreS0+gWc6pwIvI75tXWCoyQ/tuN 5Az7/L2s2DX9i8WdQr9/hJR++IOJlfgdiq7q0bDmxe2CMa1kNYMjrwesH8SfaIu67dFe 89Fjv4qM76oKNLZOfldxluqI5+Xpz4lU9C4xouEnztRdOMM7qO3VFV5f2PsrwpeYeVVw Q6tw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:reply-to:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:subject:message-id:in-reply-to:to:references:date :mime-version:from:delivered-to:arc-authentication-results; bh=vPAQfwqYE0lzuEQom/7zmBY1r/Pac5w1kpMDa+OT3lE=; b=ZSqU24F8sNR80jmZYFgdrVfiNHl8a4/tv0X4sNm1dnc7iTpDOjUn9Zd0sw6uDkbcDi WQ1fJT2WPfQxQBXLo0AhUYjmjmm6gjpbAUCIafIO1sarslD0B4ScOXFus+kPhbwPUPPc /Icp7M3vwVeVNrjKr9RA9M/wD9vHq2HHdDTtL3jPmzt3JMBFNzVEHT5Ag9Mr49prxwG0 vjI+GRWAK5+qKRDYk0dPsfqib2ZutKnaL9fGzB2x8/Uuc/EuwQ82Jz6kt7fr323jQgNl blZ+QOwN36pXpN5pgVFc9POxAESakAnunqq4IhQmse5pCaSoeQygFoxD8vPVJLTg+hpE qMhQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id m3si1287367wmc.29.2017.11.16.09.15.00; Thu, 16 Nov 2017 09:15:01 -0800 (PST) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id CF5E7689E1F; Thu, 16 Nov 2017 19:14:43 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from server172-2.web-hosting.com (server172-2.web-hosting.com [68.65.122.110]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id C931C689B83 for ; Thu, 16 Nov 2017 19:14:37 +0200 (EET) Received: from cpe-104-162-94-162.nyc.res.rr.com ([104.162.94.162]:35424 helo=[10.0.1.9]) by server172.web-hosting.com with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.89) (envelope-from ) id 1eFNkY-002FtH-5G for ffmpeg-devel@ffmpeg.org; Thu, 16 Nov 2017 12:14:51 -0500 From: Dave Rice Mime-Version: 1.0 (Mac OS X Mail 11.0 \(3445.1.7\)) Date: Thu, 16 Nov 2017 12:14:30 -0500 References: <7788b42b-7cf4-887f-ca2e-b4ea6f5f42ee@gmail.com> <199acbe1-edc9-f780-b704-d044a10ec37e@gmail.com> <19971e99-b96b-b1ee-f220-e8a4790a3404@gmail.com> To: FFmpeg development discussions and patches In-Reply-To: Message-Id: <5E7D2AAF-480A-4AF5-AC59-1D13A8086827@dericed.com> X-Mailer: Apple Mail (2.3445.1.7) X-OutGoing-Spam-Status: No, score=-2.9 X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - server172.web-hosting.com X-AntiAbuse: Original Domain - ffmpeg.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - dericed.com X-Get-Message-Sender-Via: server172.web-hosting.com: authenticated_id: dave@dericed.com X-Authenticated-Sender: server172.web-hosting.com: dave@dericed.com X-Source: X-Source-Args: X-Source-Dir: X-From-Rewrite: unmodified, already matched Subject: Re: [FFmpeg-devel] [PATCH] movenc: write clap tag X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" > On Nov 16, 2017, at 11:30 AM, Dave Rice wrote: > >> On Jul 9, 2017, at 7:26 PM, Dave Rice wrote: >> >>> On Jul 7, 2017, at 7:06 PM, Derek Buitenhuis 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 > Date: Thu, 16 Nov 2017 11:29:06 -0500 > Subject: [PATCH] avformat/movenc: write clap atom for uncompressed yuv in mov Sorry, this patch should supersede the prior email's patch. I realized that Apple requires new uncompressed ycbcr files to use version 2 in the Image Description, so I reused the uncompressed_ycbcr variable to add that in as well. From 3ea99e7d22f67b8a556152acbcbc8bf2eeec8a39 Mon Sep 17 00:00:00 2001 From: Dave Rice Date: Thu, 16 Nov 2017 11:29:06 -0500 Subject: [PATCH 1/2] avformat/movenc: write clap atom for uncompressed yuv in mov fixes 6145 --- libavformat/movenc.c | 32 +++++++++++++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) diff --git a/libavformat/movenc.c b/libavformat/movenc.c index cc3fc19d9b..98fcc7a44b 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; @@ -1832,6 +1847,13 @@ static int mov_write_video_tag(AVIOContext *pb, MOVMuxContext *mov, MOVTrack *tr char compressor_name[32] = { 0 }; int avid = 0; + 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); + avio_wb32(pb, 0); /* size */ if (mov->encryption_scheme != MOV_ENC_NONE) { ffio_wfourcc(pb, "encv"); @@ -1842,7 +1864,11 @@ static int mov_write_video_tag(AVIOContext *pb, MOVMuxContext *mov, MOVTrack *tr avio_wb16(pb, 0); /* Reserved */ avio_wb16(pb, 1); /* Data-reference index */ - avio_wb16(pb, 0); /* Codec stream version */ + if (uncompressed_ycbcr) { + avio_wb16(pb, 2); /* Codec stream version */ + } else { + avio_wb16(pb, 0); /* Codec stream version */ + } avio_wb16(pb, 0); /* Codec stream revision (=0) */ if (track->mode == MODE_MOV) { ffio_wfourcc(pb, "FFMP"); /* Vendor */ @@ -1969,6 +1995,10 @@ static int mov_write_video_tag(AVIOContext *pb, MOVMuxContext *mov, MOVTrack *tr if (track->par->sample_aspect_ratio.den && track->par->sample_aspect_ratio.num) { mov_write_pasp_tag(pb, track); } + + 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);