Open mbunkus opened 1 year ago
Please note that the output (Known element, but invalid at this position…
is only generated for instances of EbmlDummy
. mkvinfo
will itself try to map the ID contained in the EbmlDummy
element to known element IDs & their names.
The programs in the MKVToolNix package use the
FindNextId
function for finding the first elements: the EBML Head & the Matroska Segment.However, there may be other elements present: EBML Void & EBML CRC32 [^1]. EBML Void is something that
mkvpropedit
used to create as a top-level element in certain situations. Unfortunately, there are quite a lot of programs that simply don't support EBML Void elements in the top-level position in the EBML Body, including libEBML & ffmpeg.In the case of libEBML the following happens:
ebml_stream->FindNextID(EBML_INFO(EbmlHead), 0xFFFFFFFFL)
is run first.EbmlStream::FindNextID
dispatches toEbmlElement::FindNextID
under the hood.ebml_stream->FindNextID(EBML_INFO(KaxSegment), 0xFFFFFFFFFFFFFFFFLL)
is run next.EbmlDummy
instead ofEbmlVoid
.Note that the related function
FindNextElement
does support global elements. Unfortunately I cannot useFindNextElement
for theKaxSegment
asFindNextElement
attempts to read the whole element into memory, which is obviously not going to work with big Matroska files.Here is a test file created with a slightly modified
mkvmerge
: there's a small EBML Void element between the EBML Head & the Matroska Segment. The currentmkvinfo
output shows how this fails:Currently
mkvmerge
doesn't support such files, but I'll fix that soonish.ffmpeg
also fails, but that isn't our problem, of course.[^1]: The EBML RFC says: "EBML allows some special Elements to be found within more than one parent in an EBML Document or optionally at the Root Level of an EBML Body." (emphasis mine)