Subject: [Cellar] How does Matroska signal sync/IDR frames?

From: Michael Bradshaw <[email-masked]>
Date: Fri, 10 May 2019 15:51:32 -0700

>From what I understand, Matroska signals keyframes either in the
SimpleBlock's header or in a BlockGroup (implicitly by the lack
of ReferenceBlock elements).

However, the term "keyframe" isn't well defined. Are all keyframes IDR
frames? Or are non-IDR I-frames also considered keyframes? If so, is there
any way to distinguish which frames are IDR frames?

---

From: Andreas Rheinhardt <[email-masked]>
Date: Thu, 30 May 2019 21:47:00 +0000

> any way to distinguish which frames are IDR frames?
Matroska does not distinguish between sync samples and RAP samples
(random access points). A keyframe in Matroska is therefore equivalent
to the latter.
I frames alone are not necessarily keyframes, as nothing guarantees
that the frames following it can be correctly (or even approximatively
correctly -- Matroska does not require the output of the frames after
a seek to a RAP to be 100% the same as the output of the decoder when
one starts decoding from an earlier keyframe/the beginning of the
track) decoded: Frames following this I frame (both in decoding as
well as in presentation order) may after all reference frames before
the I frame.

- Andreas

PS: I already sent this email on 11.05.2019, but due to a change in my
email address from @googlemail.com to @gmail.com it didn't reach the
mailing list. Therefore I am resending this.

---

From: Michael Bradshaw <[email-masked]>
Date: Fri, 31 May 2019 10:40:44 -0700

Thanks, Andreas.

First, to clarify, a RAP sample is to I-frames as a sync sample is to
IDR-frames, right? I always get sync/RAP mixed, but for some reason I can
remember I-frame vs IDR-frame.

Here's my attempt at interpreting your reply and mapping it to the Matroska
spec:

   - SimpleBlock with keyframe flag set to 0: Do not treat as a
   sync/IDR-frame.
   - SimpleBlock with keyframe flag set to 1: Treat as sync/IDR-frame? Or
   just as an I-frame (but not a sync-IDR-frame)?
   - BlockGroup with no ReferenceBlock elements: I-frame, but not
   necessarily a sync/IDR-frame.
   - BlockGroup with ReferenceBlock elements: Not an I-frame (and thus not
   a sync/IDR-frame).

Sorry for the back-and-forth; I just want to make sure I get this right.