Re: [Cellar] QuickTime timecode tracks in Matroska, was Ancillary data in Matroska

Dave Rice <dave@dericed.com> Tue, 14 March 2017 19:14 UTC

Return-Path: <dave@dericed.com>
X-Original-To: cellar@ietfa.amsl.com
Delivered-To: cellar@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id 1F2CF129439 for <cellar@ietfa.amsl.com>; Tue, 14 Mar 2017 12:14:39 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: 0.653
X-Spam-Level:
X-Spam-Status: No, score=0.653 tagged_above=-999 required=5 tests=[HTML_MESSAGE=0.001, SPF_NEUTRAL=0.652] autolearn=no autolearn_force=no
Received: from mail.ietf.org ([4.31.198.44]) by localhost (ietfa.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id hKgchc5yI8pd for <cellar@ietfa.amsl.com>; Tue, 14 Mar 2017 12:14:37 -0700 (PDT)
Received: from s172.web-hosting.com (s172.web-hosting.com [68.65.122.110]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id E96EC1298AF for <cellar@ietf.org>; Tue, 14 Mar 2017 12:14:36 -0700 (PDT)
Received: from cpe-104-162-86-103.nyc.res.rr.com ([104.162.86.103]:47666 helo=[10.0.1.4]) by server172.web-hosting.com with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.87) (envelope-from <dave@dericed.com>) id 1cnrty-001Tzq-KR for cellar@ietf.org; Tue, 14 Mar 2017 15:14:36 -0400
From: Dave Rice <dave@dericed.com>
Content-Type: multipart/alternative; boundary="Apple-Mail=_918FA47F-D976-4564-8334-409A5D03483B"
Mime-Version: 1.0 (Mac OS X Mail 10.2 \(3259\))
Date: Tue, 14 Mar 2017 15:14:31 -0400
References: <2651a6f3-9c9a-6f76-2ee7-4d5c23b1ce57@mediaarea.net> <BFB215F1-1254-409C-817A-7AB1A772437A@dericed.com> <922C5404-EC19-462D-A836-C952E66C2FD8@dericed.com>
To: Codec Encoding for LossLess Archiving and Realtime transmission <cellar@ietf.org>
In-Reply-To: <922C5404-EC19-462D-A836-C952E66C2FD8@dericed.com>
Message-Id: <B3BE02C3-9402-4802-BC9E-3F95020C641D@dericed.com>
X-Mailer: Apple Mail (2.3259)
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 - ietf.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
Archived-At: <https://mailarchive.ietf.org/arch/msg/cellar/flGPjiu-YBdpAgDQ-IUZNBY1wfk>
Subject: Re: [Cellar] QuickTime timecode tracks in Matroska, was Ancillary data in Matroska
X-BeenThere: cellar@ietf.org
X-Mailman-Version: 2.1.22
Precedence: list
List-Id: Codec Encoding for LossLess Archiving and Realtime transmission <cellar.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/cellar>, <mailto:cellar-request@ietf.org?subject=unsubscribe>
List-Archive: <https://mailarchive.ietf.org/arch/browse/cellar/>
List-Post: <mailto:cellar@ietf.org>
List-Help: <mailto:cellar-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/cellar>, <mailto:cellar-request@ietf.org?subject=subscribe>
X-List-Received-Date: Tue, 14 Mar 2017 19:14:39 -0000

> On Feb 23, 2017, at 11:18 PM, Dave Rice <dave@dericed.com> wrote:
> 
> Hi all,
> 
>> On Jan 7, 2017, at 11:57 AM, Dave Rice <dave@dericed.com <mailto:dave@dericed.com>> wrote:
> 
> […]
> 
>>> On Dec 27, 2016, at 3:22 PM, Jerome Martinez <jerome@mediaarea.net <mailto:jerome@mediaarea.net>> wrote:
> 
> […]
> 
>>> "N_" prefix arbitrary used (2nd letter of "Ancillary" because first letter is already used)
>> 
>> Please also add a patch for the TrackType Element in ebml_matroska.xml as we’ll need an unsigned integer to represent the ‘ancillary’ type of track.
>> 
>>> N_QUICKTIME: is a pure copy of V_QUICKTIME and A_QUICKTIME already supported in Matroska, N_ would be used which would be used for e.g. tmcd codec (QuickTime time code). Exactly same principles as video and audio. Note that classic usage is to store only the first frame content and other content is computed from it, so a player would have to read the first frame even if there is a direct seek request to another place; this could be avoided with some "hack" in the track header, could be the next step after this one is accepted.
>> 
>> Would need a clear caveat in the definition that this implementation would only support storage of the first timecode value and computation of each additional value. A transwrap from a mov file with a timecode track that uses an edit list to handle non-continuous timecode could not be a lossless transwrap in this case, since the edit list would be lost and the new timecode track in the Matroska file would appear continuous.
>> 
>> Also reference to tmcd atom is not clear enough. Is it tref/tmcd, gmhd/tmcd, stsd/tmcd.
>> 
>> If this is stsd/tmcd (I presume), then what time scale should be used? The time scale stored in tmcd or the time scale of the Matroska track?
>> 
>> I like that copying stsd/tmcd copies in the timecode label as well.
> 
> I started a draft of a PR for defining QuickTime-style timecode in Matroska based on Jerome’s suggestion, see https://github.com/Matroska-Org/matroska-specification/pull/102 <https://github.com/Matroska-Org/matroska-specification/pull/102>. I left CodecPrivate as containing the entire Sample description table array of the stsd atom, rather than starting after the track type atom (such as the image descriptor, sound descriptor), because in the case of timecode, values of the tmcd are needed to interpret what the successive timecode values will be. The description of the Codec Mapping uses timecode as an example of ancillary data but not exclusively. Perhaps we should constrain what quicktime media types are relevant here, as several of the media types defined at https://developer.apple.com/library/content/documentation/QuickTime/QTFF/QTFFChap3/qtff3.html#//apple_ref/doc/uid/TP40000939-CH205-SW1 <https://developer.apple.com/library/content/documentation/QuickTime/QTFF/QTFFChap3/qtff3.html#//apple_ref/doc/uid/TP40000939-CH205-SW1> could be considered as ancillary. Comments?

After looking at this some more, I decided to create an alternate proposal for a T_QUICKTIME codec mapping, rather than to store QuickTime-style timecode in the more vague concept of an ancillary N_QUICKTIME. See the pull request at https://github.com/Matroska-Org/matroska-specification/pull/112 <https://github.com/Matroska-Org/matroska-specification/pull/112>.

For reference the proposed definition of T_QUICKTIME is:
{
Codec ID: T_QUICKTIME

Codec Name: QuickTime timecode track

Description: `T_QUICKTIME` is used to identify Timecode tracks as stored in QuickTime. The `QuickTime Timecode Sample Data` is stored within the Block's data section. For an explanation of `QuickTime Timecode Sample Data` read [QuickTime File Format Specification](https://developer.apple.com/library/content/documentation/QuickTime/QTFF/QTFFChap3/qtff3.html#//apple_ref/doc/uid/TP40000939-CH205-57421).

Initialisation: The `Private Data` contains the `Timecode Sample Description` which in QuickTime is stored within the 'tmcd' atom after the mandatory `data reference index` value. For an explanation of the `Timecode Sample Description` read [QuickTime File Format Specification](https://developer.apple.com/library/content/documentation/QuickTime/QTFF/QTFFChap3/qtff3.html#//apple_ref/doc/uid/TP40000939-CH205-69831).
}

Attached is a draft Matroska file with an T_QUICKTIME style timecode track.



The CodecPrivate section uses the QuickTime Timecode Sample Data which for this attachment is 000000000000000100007530000003E91E00000000136E616D650007000054415045233534, which equates to:

00000000        0           Resserved
00000001        1           Timecode flags
00007530        30000       Time scale
000003E9        1001        Frame duration
1E              30          Number of frames
00              0           Reserved
00000013        19          Size of name atom
6E616D65        name        Fourcc of name atom
 0007           7           Size of Timecode Label
 0000           en          Language of Timecode Label
 54415045233534 TAPE#54     Timecode Label

This example includes a timecode label, the shortest possible Private Data for T_QUICKTIME would be 18 bytes:

00000000        0           Resserved
00000001        1           Timecode flags
00007530        30000       Time scale
000003E9        1001        Frame duration
1E              30          Number of frames
00              0           Reserved

The attachment contains a SimpleBlock using the T_QUICKTIME with a example value of 0x0001fc8c, which according to the QuickTime Timecode Sample Data is 01:12:23;28 and subsequent timecode values for the track would be calculated according to the incrementation defined in the Private Data.

Comments?
Dave Rice