From patchwork Sun Nov 19 02:19:17 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Dave Rice X-Patchwork-Id: 6184 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.2.161.94 with SMTP id m30csp2362424jah; Sat, 18 Nov 2017 18:19:45 -0800 (PST) X-Google-Smtp-Source: AGs4zMaDCVQrdeuEVWMQlBCTW4urxYFNu9E/EM7cy6/a/jaw2yKLShmli/aFmiJ8ur0LXCmgvB8G X-Received: by 10.223.164.135 with SMTP id g7mr8011971wrb.211.1511057985228; Sat, 18 Nov 2017 18:19:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1511057985; cv=none; d=google.com; s=arc-20160816; b=lq/xIYu1SnUiBgL+1Jx45LE0f/ir7Sx7rxnVIxfE4YLSRIKWCpUG0Xh/aRr67OXKnM QQ1HRBUtBX4NGC8uplb/dfcY4CkRJNZTqug9sFfFcEa6pxMXpzbAK15/MKZh1MCRrFoN 3bAo3yiieutUnV91pfmh7bygvckW/rYUe6VIPmJahbP8bRkLiel8k/tgj+Fk0RGF3mhp AuJ95/YS+eVCNFnzJufvoLj5V8Vs6cLiRd82bjtDHZYZdClcG2EQukOyH68pU99v2ADO cKt4MoJ1X23zdQENT0JvSr2BS6rbCS5z0+423FhzzBsLWKU4hdV3WJJzA/l6nTw/udUV PdtQ== 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:to:date:message-id:mime-version:from :delivered-to:arc-authentication-results; bh=gzDOKB0e7BhFhADYIr1SI1bMhSSKtoet9of1rz3R+WA=; b=Tuo+XUWec+X5K9fy34ieudPPqO4+EIMtox/fxMsuWUtfLvPDRQE5JpeDFT4I7j2wmG VuRYtmVfyNVscX/S+4ldPou9QOoGdfD3/LJMbA3S+4brjUvbo+TzaPE2rEuW3iokEn4b X1zg2SKdWESF39Mi+KRC+aMzmxyo/IkTO6KsHDzfGH/tcwMe8gNeCq2uicYixj1vrVIt vLXhnWBeuJQp4mcFDDqvpS6KxdFaCqqW3jVaQW55F+D2926qyUEHVZsHaLWrf9+TokaT rs83OR8KIRW/T1k3g59IiQ1wD3vPXOb3GKGaTowJ2M01U1np9C5bl2LkwQTSHDKRyNuZ FuoQ== 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 a138si180325wma.5.2017.11.18.18.19.44; Sat, 18 Nov 2017 18:19:45 -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 139CF68A132; Sun, 19 Nov 2017 04:19:18 +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 943F268A100 for ; Sun, 19 Nov 2017 04:19:10 +0200 (EET) Received: from cpe-104-162-94-162.nyc.res.rr.com ([104.162.94.162]:47711 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 1eGFCa-003Fya-Gp for ffmpeg-devel@ffmpeg.org; Sat, 18 Nov 2017 21:19:24 -0500 From: Dave Rice Mime-Version: 1.0 (Mac OS X Mail 11.1 \(3445.4.7\)) Message-Id: <9A78E2AA-B26D-487D-B564-7118F34AD094@dericed.com> Date: Sat, 18 Nov 2017 21:19:17 -0500 To: FFmpeg development discussions and patches X-Mailer: Apple Mail (2.3445.4.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: [FFmpeg-devel] [PATCH 1/4] avformat/movenc: correct ImageDescription for uncompressed ycbcr 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" This patch set updates movenc to write uncompressed ycbcr in mov following requirements in Appleā€™s TN2162, https://developer.apple.com/library/content/technotes/tn2162/_index.html. Thanks to Carl and Michael for comments on an earlier version of this patchset. From 26d9ca470f104d8448000b13c2cc97b8fc5c15ba Mon Sep 17 00:00:00 2001 From: Dave Rice Date: Thu, 16 Nov 2017 11:53:32 -0500 Subject: [PATCH 1/4] avformat/movenc: correct ImageDescription for uncompressed ycbcr Per https://developer.apple.com/library/content/technotes/tn2162/_index.html . --- libavformat/movenc.c | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/libavformat/movenc.c b/libavformat/movenc.c index cc3fc19d9b..ce51c4b3d2 100644 --- a/libavformat/movenc.c +++ b/libavformat/movenc.c @@ -1832,6 +1832,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,11 +1849,15 @@ 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 */ - if (track->par->codec_id == AV_CODEC_ID_RAWVIDEO) { + if (track->par->codec_id == AV_CODEC_ID_RAWVIDEO || uncompressed_ycbcr) { avio_wb32(pb, 0); /* Temporal Quality */ avio_wb32(pb, 0x400); /* Spatial Quality = lossless*/ } else { @@ -1870,7 +1881,10 @@ static int mov_write_video_tag(AVIOContext *pb, MOVMuxContext *mov, MOVTrack *tr avio_w8(pb, strlen(compressor_name)); avio_write(pb, compressor_name, 31); - if (track->mode == MODE_MOV && track->par->bits_per_coded_sample) + if (track->mode == MODE_MOV && + (track->par->codec_id == AV_CODEC_ID_V410 || track->par->codec_id == AV_CODEC_ID_V210)) + avio_wb16(pb, 0x18); + else if (track->mode == MODE_MOV && track->par->bits_per_coded_sample) avio_wb16(pb, track->par->bits_per_coded_sample | (track->par->format == AV_PIX_FMT_GRAY8 ? 0x20 : 0)); else