Closed Bug 1696056 Opened 3 years ago Closed 3 years ago

AVIF images with transparency not interoperable with Chrome

Categories

(Core :: Graphics: ImageLib, defect)

Firefox 88
defect

Tracking

()

RESOLVED DUPLICATE of bug 1689806

People

(Reporter: pornel, Unassigned, NeedInfo)

References

(Blocks 2 open bugs)

Details

Attachments

(2 files)

User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:88.0) Gecko/20100101 Firefox/88.0

Steps to reproduce:

Firefox requires more HEIF/MIAF metadata for alpha channels than Chrome/libavif. This means there are AVIF images which work in Chrome, but don't work in Firefox.

This includes all transparent images created by cavif-rs and Cloudflare. I don't know exactly what is missing, because MIAF spec is non-free. But given that libavif has no problem with these images, it can't be anything important, and/or Firefox may be requiring something that shouldn't be required.

Actual results:

"image cannot be displayed, because it contains errors"

Expected results:

Firefox should be able to display AVIF images that Chrome can.

Component: Untriaged → ImageLib
Product: Firefox → Core

Hi Kornel,

Have you tried running this image through the Validator for AOM AV1 image files website (https://gpac.github.io/ComplianceWarden-wasm/avif.html)? I just did and got a number of errors, a subset of which can be found below.

I understand it is frustrating that the MIAF spec is non-free (listed for 138 CHF or ~150 USD at https://www.iso.org/standard/74417.html). If this is a blocker please contact me and Xiph.Org will sponsor your purchase of the document.

+--------------------------------------+
| miaf validation |
+--------------------------------------+

Specification description: MIAF (Multi-Image Application Format)
MPEG-A part 22 - ISO/IEC 23000-22 - w18260 FDIS - Jan 2019

[miaf][Rule #1] Error: The HandlerBox shall be the first contained box within the MetaBox
[miaf][Rule #2] Error: compatible_brands list shall contain 'miaf' (not found) and 'mif1' (not found)
[miaf][Rule #4] Error: 'hdlr' not found in MetaBox
[miaf][Rule #24] Error: Found 0 'pixi' associated for 2 displayable (not hidden) images

========================================
[miaf] 4 error(s), 1 warning(s).
========================================

===== Involved rules descriptions:

[miaf][Rule #1] Section 7.2.1.1
The HandlerBox shall be the first contained box within the MetaBox.

[miaf][Rule #2] Section 7.2.1.2
The FileTypeBox shall contain, in the compatible_brands list,
the following (in any order): 'mif1' (specified in ISO/IEC 23008-12)
[...]
Files conforming to the general restrictions in clause 7 shall include
the brand 'miaf' in the compatible_brands in the FileTypeBox.

[miaf][Rule #4] Section 7.2.1.5
The handler type for the MetaBox shall be 'pict'.

[miaf][Rule #24] Section 7.3.6.6
The pixel information property shall be associated with every image that is
displayable (not hidden)

How is this issue different from bug 1689806? As far as I can tell the problem is the same: the file is invalid because it lacks the required mif1 entry in the compatible_brands field of the ftyp box. I've attached a version that adds it and that works for me in Firefox Nightly 88.0a1 (2021-02-26) and 87.0b4.

The fact that AVIF requires the mif1 compatible brand has been known since you filed this issue on the parsing library Firefox uses back in August and the author of the AVIF spec confirmed that it is required.

Also, in this issue on your own tool's repo the same issue was discussed and this comment, which you 👍'd, suggested https://gpac.github.io/ComplianceWarden-wasm/avif.html, a freely-available tool to check whether AVIF files are valid according to the spec. Given your attached example, its output also contains the answer:

[miaf][Rule #2] Section 7.2.1.2
The FileTypeBox shall contain, in the compatible_brands list,
the following (in any order): 'mif1' (specified in ISO/IEC 23008-12)

as well as a number of other issues with regards to compliance.

I agree the UX for this error case could be better (and I've filed bug 1696088 to address that), so if you want an easier way to see what is causing parsing errors in Firefox specifically, you can run the dump command from the mp4parse crate directly like so:

$ cargo run --example dump transparency_demonstration.avif 
[…]
[2021-03-03T03:25:18Z DEBUG mp4parse_capi] mp4parse::read_avif -> Err(InvalidData("compatible_brands must contain \'mif1\'"))
mp4parse_avif_new -> Invalid

As you may know, since I linked to these issues in the bug you previously filed, your concerns have been heard and discussed on the libavif repo and there is an effort in progress to change the MIAF and HEIF specs to change the inclusion of the mif1 compatible brand from a requirement to a suggestion.

In the meantime, is there any reason why you are unable or unwilling to add the capability for cavif-rs to generate output which includes mif1 in the compatible brands? That's all that would be necessary to make them work in Firefox today.

Flags: needinfo?(pornel)
Blocks: AVIF
Status: UNCONFIRMED → RESOLVED
Closed: 3 years ago
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: