Closed joedrago closed 3 years ago
Joe:
ISO BMFF (ISO/IEC 14496-12:2020(E)) says:
8.11.4 Primary item box 8.11.4.1 Definition Box Type: '
pitm
' Container:MetaBox
Mandatory: No Quantity: Zero or one
Does HEIF or MIAF require a pitm
box?
If there is only one item in the file, can we conclude that item must be the primary item?
Perhaps @cconcolato can help with the exact requirements. I see in MIAF (7.3.2 - Primary Item):
When a profile specified in Annex A is listed in the FileTypeBox, there shall be an image item that conforms to that profile and is among the set of items comprised of the primary item and its alternates.
This suggests that there must be "a primary item", but doesn't demand (in this clause) how the primary item's ID is derived. It is possible that requiring pitm
is one step too far, and there are other ways to derive the ID. Cyril, help!
FWIW, your explanation is currently how it works, during our search for the primary color item:
if ((data->meta->primaryItemID > 0) && (item->id != data->meta->primaryItemID)) {
// a primary item ID was specified, require it
continue;
}
We currently take the first av01
or grid
item that isn't a thumbnail for some other image, and use it as the primary item. Even if we don't ultimately require pitm
, we should probably make a better effort in explicitly choosing the primaryItemID
once and leveraging that value during the rest of Parse.
Does HEIF or MIAF require a
pitm
box?
Yes. In HEIF (ISO/IEC 23008-12:2017) § 10.2.1 "'mif1'
structural brand", there's a subsection which includes:
The following boxes are required in a file under the
'mif1'
brand
and that table includes pitm
.
Additionally ISOBMFF requires it or something equivalent. Later in § 8.11.4.1:
Either this box must occur, or there must be a box within the meta‐box (e.g. an XML box) containing the primary information in the format required by the identified handler.
Jon: Thank you very much for looking up the requirements in the standards!
When decoding items (vs tracks), ensure that a
pitm
box exists.