Re: [Cellar] AV1 mapping Matroska

Steve Lhomme <> Mon, 02 July 2018 11:27 UTC

Return-Path: <>
Received: from localhost (localhost []) by (Postfix) with ESMTP id 742A4130F36 for <>; Mon, 2 Jul 2018 04:27:50 -0700 (PDT)
X-Virus-Scanned: amavisd-new at
X-Spam-Flag: NO
X-Spam-Score: -1.909
X-Spam-Status: No, score=-1.909 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, T_DKIMWL_WL_MED=-0.01, URIBL_BLOCKED=0.001] autolearn=ham autolearn_force=no
Authentication-Results: (amavisd-new); dkim=pass (2048-bit key)
Received: from ([]) by localhost ( []) (amavisd-new, port 10024) with ESMTP id SHEf5okTODP8 for <>; Mon, 2 Jul 2018 04:27:48 -0700 (PDT)
Received: from ( [IPv6:2607:f8b0:400e:c05::234]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by (Postfix) with ESMTPS id DB983130F2F for <>; Mon, 2 Jul 2018 04:27:47 -0700 (PDT)
Received: by with SMTP id y5-v6so743914pgv.1 for <>; Mon, 02 Jul 2018 04:27:47 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;; s=20150623; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=L4OTMSSYc4wjGZBMaxqb+l1z0V9e/2zxrrMxcMP89/E=; b=ZZ0K/stevxa7jJqCVZpx+wGdI36JkC9KRfTJWIPL2CLXHEAOjFxpBbYP6mL2F4tg3A B/6utqbJdGkbPjNTT8h6pb/wXTVCbdWW9V/w9ZM0LlYjOfkk9Xth+qqlqqQoa0msj88W b4hYLUfxkCxc4e2D2peRuysUTAdMC1cvL0T+XVf1xVljVm+A+X39yhlQdUlU6Iqrx2FA F/gsyHPNy09DxuWmNnIIAJK9ImsaB0nMvuPXC/YaksjA+Zr/jSOv9bZdDE5kMvkSAeyP 0XtG+9ngSalVqbvq243kkYbUrjvVtqmkqKPCW+t2XFU8q8fNuYU4G0/6Fv8PmWQrEI/a gqXg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=L4OTMSSYc4wjGZBMaxqb+l1z0V9e/2zxrrMxcMP89/E=; b=JYh+Xaxxm2Md9y30fo3nNCkuN9bulyBwxoFl5CE2Fi08FaPMYzzl7hbcjUTP6YkMLR r+CsXVjTi6pS9oUPMcGMFrKaE6o+XNNK6nP8dIqHFCXJMaMOtNAPz67G5fmuAFxR6yYu oSWwye4v7zu5OAC/nyaL6RRTDH3aYuNE7u9047s8G5da8HcoUe8/06ZZbIyEvJsw+d7M Er/ULet5sg+EjYOzruSyLAFELQ+hfF7F17hrYygOUHJNSB8u31aOclMDCcwjCHYNjFQn 9Xm78eDuncjebuoBSQ48HTdP2Zfl2hZDev+6tLgnYvd504bkCqi64vympwRBMRcx21Km HS5g==
X-Gm-Message-State: APt69E3KR9gsH/bt+FAlMjAmCjxUtYj4hWEGt4xirAdHYZ7DJ5/Xrnnp KeiVsyu5EtmpJXGViGcYb5/r5LO3GIermJBlXsy3mlt3
X-Google-Smtp-Source: AAOMgpe1thVCIEumTWq6lH31T+c6vCH6q7+kdXN8P8atXkzsa8G8lsQI/emsPqOO/LCZdLS0MaxlQGY4x1jmph0KpXE=
X-Received: by 2002:a62:b20c:: with SMTP id x12-v6mr16038070pfe.64.1530530867294; Mon, 02 Jul 2018 04:27:47 -0700 (PDT)
MIME-Version: 1.0
Received: by 2002:a17:90a:17af:0:0:0:0 with HTTP; Mon, 2 Jul 2018 04:27:46 -0700 (PDT)
In-Reply-To: <>
References: <> <> <> <> <> <20180702103455.GQ4839@michaelspb> <> <>
From: Steve Lhomme <>
Date: Mon, 2 Jul 2018 13:27:46 +0200
Message-ID: <>
To: Jerome Martinez <>
Cc: Codec Encoding for LossLess Archiving and Realtime transmission <>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Archived-At: <>
Subject: Re: [Cellar] AV1 mapping Matroska
X-Mailman-Version: 2.1.26
Precedence: list
List-Id: Codec Encoding for LossLess Archiving and Realtime transmission <>
List-Unsubscribe: <>, <>
List-Archive: <>
List-Post: <>
List-Help: <>
List-Subscribe: <>, <>
X-List-Received-Date: Mon, 02 Jul 2018 11:27:51 -0000

2018-07-02 13:14 GMT+02:00 Jerome Martinez <>et>:
> On 02/07/2018 12:51, Steve Lhomme wrote:
>> 2018-07-02 12:34 GMT+02:00 Michael Niedermayer <>cc>:
>>> Hi
>>> On Mon, Jul 02, 2018 at 09:47:45AM +0200, Moritz Bunkus wrote:
>>>> Hey,
>>>>> Looking at the term "coded video sequence" (CVS) in other codecs (H.264
>>>>> and H.265) it seems it's a common term. And for those codec one Segment
>>>>> correspond to one CVS, with the parameters of that CVS stored in the
>>>>> CodecPrivate (SPS + PPS for H.264 for example). So we should probably
>>>>> go
>>>>> in that simple way.
>>>> I have quite a lot of h.264 samples here, mainly M2TS from DVB, where
>>>> SPS/PPS change mid-stream, often multiple times. For such files the
>>>> first
>>>> occurrences of SPS/PPS make up the AvcC in CodecPrivate, but all key
>>>> frames
>>>> are still prefixed with the currently active SPS/PPS — because that's
>>>> the
>>>> only way to signal that stuff has actually changed.
>>> IMHO All SPS/PPS should be in the "global header" (CodecPrivate) which
>>> the
>>> global header applies to, not just the first.
> Not possible with e.g. real time streaming (you don't know in advance the
> next SPS/PPS)
>>> This way an application can know all resolutions, aspect ratios and so on
>>> from just the header without the need to scan through all random access
>>> points.
>> My understanding is that it's how it's done in MP4:
>> "Each AVC sample entry, which contains the AVC video stream decoder
>> specific information, includes a group of SPSs and PPSs. This group of
>> parameter sets functions much like a codebook. Each parameter set has
>> an identifier, and each slice references the parameter set it was
>> coded against using the parameter set's identifier."
>> I have to check but I don't think Sequence Headers OBUs have
>> identifiers like that in AV1.
> Not in AV1 (I just updated my own code for AV1  1.0.0 spec, still not
> there).
> But it actually does not answer the issue because in the example there is
> usually still only the "set id" of 0 (the new SPS replaces the old one, not
> a new number).
> Actually IIRC in HEVC (same for AVC) there are explicitly 2 different codec
> identifiers:
> - "hvc1" is for *all* SPS/PPS in the global header (CodecPrivate), and there
> is no SPS/PPS in the stream itself
> - "hev1" is for *no* SPS/PPS in the global header (CodecPrivate), and key
> frames are prefixed with the currently active SPS/PPS
> (I personally don't see the need of 2 different identifiers, as it quick to
> see if SPS/PPS is in the file, but there is surely a reason)
> The issue is not only for AV1, but for all formats permitting to have the
> init in the stream itself (AVC, HEVC, AV1...).
> IMO we should not restrict to only one possibility in Matroska spec, as they
> are for different needs (non real time vs real time), whatever is the format
> (AVC, HEVC, AV1...).
>> By the way, this is one mapping for V_AV1. There could be other AV1
>> mapping in Matroska where there is no CodecPrivate and there could be
>> multiple coded video sequences in it. But it would require the use of
>> CodecState and CueCodecState which is currently not an option for
>> WebM. So for now I will concentrate on a single coded video sequence.
>> And if needed in the future we can do a different one.
> If WebM decides that real time AV1 is for them, they may decide to discard
> CodecPrivate usage and put sequence header in the "Block" (as they currently
> do with up to date AOM build)
> So restriction will not be there in practice.

Seeking in such a file would not be possible. I'm not sure it's
desirable even when doing adaptive streaming with short sequences. We
will need CodecState and CueCodecState for that. We could define such
a case (with a different codec ID) for Matroska and WebM could pick
that from there.

Also while working on the case where the Sequence Header OBU doesn't
change, I noticed an issue. The Sequence Header OBU can still change
the [operating_parameters_info] during the lifetime of the stream
(paragraph 7.5 pointed out by Tim). That means even applying the
stricter restrictions of the Codec Video Sequence in AV1 means we'd
still need CodecState and CueCodecState for seeking to work. This
change is only possible in a specific decoder model (Annex E) when
[decoder_model_info_present_flag] is 1. When it's 0 then the
[operating_parameters_info] doesn't apply. So we should probably
restrict the single Sequence Header OBU to streams where
[decoder_model_info_present_flag] is 0.

> Jérôme
> _______________________________________________
> Cellar mailing list

Steve Lhomme
Matroska association Chairman