From patchwork Thu Nov 16 16:30:16 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Dave Rice X-Patchwork-Id: 6118 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.2.161.94 with SMTP id m30csp6017276jah; Thu, 16 Nov 2017 08:30:42 -0800 (PST) X-Google-Smtp-Source: AGs4zMYEJ+v+oGE+GZfG+L2AfDgutJEaZ86gQ3sP0ABprdVJx1BuVdyf0yr812Yf6sHR9mju1qm3 X-Received: by 10.223.181.131 with SMTP id c3mr1968707wre.198.1510849842079; Thu, 16 Nov 2017 08:30:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1510849842; cv=none; d=google.com; s=arc-20160816; b=enB7fe2fRTjMm7V6Zt8278/3/PU38//V96b/3QlpBRHAG9XlhwsWtVTm8hELE8Eogi brwNjs5iDt+WieYdWMwRVdfvLsnMwk0C5P8ELONwkzonGzdlskSsuRg0UUfngkZZFgMl Byl23XML7VGmVOVnNoQriLKSi8jlmZIg7KpESXjgCMBiPv/qEIuqbA1yjBkyPHedcErA I2zl6W9JVLumSeJRJYdHQO7Vt7IgA8U9Nelf3fJfML+Mi5v+HqM4E29FMflsrk/TW+7v x6QFUJteoaf+uMBajEixFD2dnrxwf3Xh0TFJ5b8CCN5YO2ZkCxhxlWW5BclEZ46DSLcZ wY+w== 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=okpBfwXa0y/cRHdUBhMXOSHniJ0qdQx47/Omx5OB+7c=; b=M1lmSML97+2C5+AJ9RR1EBHj/CXNytaglwks27MMOe6E1PASKEIErEG7LyEHxunh2B Ro3AqZPw8nwneYGYnnp6eQMM4/Wsm17cdDP10pbRh71iie/Arnx/zzkx+wG8+CuPolFN dW0VfFKufZ5ukrriERZkVR6jxWEg2oWKoRnAQIPOfJmLnplOKe255mEjLReoIa9zeBIx mDYqBnnbRkt2MQEmobgQ3t0mAY8yFR3lpO8dr7hcpvKeqTtJK/n+3oLZxhN9sBye0izh vpEhk7sFbywJcNcwoULdbe8XYdJTEeGs6Cv2H7h0JF8qEVaRHNXwWKPWrCnOgH8a8cRD 0LyQ== 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 d103si1322887wma.133.2017.11.16.08.30.40; Thu, 16 Nov 2017 08:30:42 -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 C36D168A057; Thu, 16 Nov 2017 18:30:23 +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 2C8A6689E5C for ; Thu, 16 Nov 2017 18:30:17 +0200 (EET) Received: from cpe-104-162-94-162.nyc.res.rr.com ([104.162.94.162]:37295 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 1eFN3d-001YQ0-Cd for ffmpeg-devel@ffmpeg.org; Thu, 16 Nov 2017 11:30:30 -0500 From: Dave Rice Mime-Version: 1.0 (Mac OS X Mail 11.0 \(3445.1.7\)) Date: Thu, 16 Nov 2017 11:30:16 -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: 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 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 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); }