Closed Bug 1689806 Opened 3 years ago Closed 3 years ago

AVIF parsing is stricter than in Chrome, leading to interoperability issues for Firefox

Categories

(Core :: Graphics: ImageLib, defect, P3)

Firefox 87
defect

Tracking

()

RESOLVED FIXED
Tracking Status
firefox90 --- fixed

People

(Reporter: pornel, Assigned: jbauman, NeedInfo)

References

(Blocks 1 open bug)

Details

Attachments

(3 files)

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

Steps to reproduce:

AVIF files that work in Chrome/libavif aren't displayed in Firefox.

There are two reasons:

  1. Firefox requires HEIF to declare MIAF brands metadata, but Chrome only checks for ftyp==avif. https://github.com/AOMediaCodec/libavif/issues/480

  2. Firefox requires some additional data for alpha channels, which Chrome/libavif doesn't need. I haven't figured out what it is yet — the files in question are parsed fine by Mozilla's mp4parse, and yet won't display in Firefox 87a.

Actual results:

AVIF files that work in Chrome 90 fail in Firefox 87a with "The image [] cannot be displayed, because it contains errors"

Expected results:

Firefox is theoretically more spec-compliant, but IMHO this approach causes more pain than value. HEIF is a tower of many old ISO specs (including non-free MIAF) with many quirks, so it's not easy to generate files that tick all the compliance boxes.

OTOH Chrome's minimal implementation allows AVIF files to be smaller and simpler, which is IMHO preferable for a new web-oriented format.

Component: Untriaged → ImageLib
Product: Firefox → Core
  1. Firefox requires HEIF to declare MIAF brands metadata, but Chrome only checks for ftyp==avif. https://github.com/AOMediaCodec/libavif/issues/480

This is what the standard requires, so currently libavif (and therefore Chrome) are accepting invalid files. It's an unfortunate situation to be in, but we're actively looking to improve the spec and make the behavior consistent. There are relevant issues for this in mp4parse, libavif and the MIAF spec. Gecko isn't the right place for this issue, but this is an important point, so let's continue the discussion in those places.

  1. Firefox requires some additional data for alpha channels, which Chrome/libavif doesn't need. I haven't figured out what it is yet — the files in question are parsed fine by Mozilla's mp4parse, and yet won't display in Firefox 87a.

I'm not sure what you're referring to, but this definitely would be a gecko issue. Can you provide any examples? I tried adding the missing mif1 brand to the file you attached to this bug, and it rendered fine for me in 87.0a1 (2021-02-01).

The original file, but with the mif1 brand added

Flags: needinfo?(pornel)
Severity: -- → S3
Priority: -- → P3
I ran the attached bug-1689806-PNG_transparency_demonstration_1-fixed.avif 
validation

Accidentally, posted too early.

I ran the online AVIF validator (https://gpac.github.io/ComplianceWarden-wasm/avif.html) against the attached bug-1689806-PNG_transparency_demonstration_1-fixed.avif and still got these conformance errors.

Assignee: nobody → jbauman
Blocks: avif-default
Depends on: 1712368

We've been working with the Chrome and libavif (which Chrome uses for parsing) to reach consistency here, and I think we've basically achieved that. See https://bugzilla.mozilla.org/show_bug.cgi?id=avif-compliance for more details.

Status: UNCONFIRMED → RESOLVED
Closed: 3 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: