Skip to content
  • Jehan's avatar
    Issue #2209: more accurate magic for HEIF files. · 4ad3993e
    Jehan authored
    Just looking for "ftyp" would also match other ISOBMFF files (.mov or
    .mp4 files for instance). These are the possible 4-byte "brand" code
    which can follow "ftyp", as listed by Dirk Farin from libheif.
    
    I add the "mif1" brand, as I encountered some files using this magic
    (even though this should normally not be valid apparently, yet the file
    loaded fine in GIMP).
    
    This is not perfect as the standard allows potentially very big box
    headers, in which case 8 bytes (the "largesize" slot) may be inserted
    between "ftyp" and the brand, as I understand it. But this is actually
    unlikely enough to probably never happen (the compatible brands list
    would have to be huuuge, as it looks like this is the only extendable
    part in a ftyp box). So let's assume this just never happens.
    
    See also: https://github.com/strukturag/libheif/issues/83
    4ad3993e