Jump to content

Some AVIFs cannot be opened in Firefox


Go to solution Solved by null54,

Recommended Posts

Version
- Windows 10
- paint.net 5.0.12 (Stable 5.12.8735.38135)
- Google Chrome Version 121.0.6167.140 (Officiel version) (64-bit)
- Firefox 122.0 (64-bit)
- AvifFileType v1.1.27.0
- AOM v3.7.1-664-g94fe92f0ed

 

Bug
paint.net will at times generate avif images which does not conform to the standard. I have not been able to track down when/why. Saving a series of 10 avif files in different resolutions caused problems with 4.

 

The images can be reopened with paint.net and displayed in Chrome but fails in Firefox.

 

Firefox has previously been reluctant to address avif issues if they where non-conforming:
https://bugzilla.mozilla.org/show_bug.cgi?id=1700723

 

The check is done using:
https://gpac.github.io/ComplianceWarden-wasm/index.html

 

The 4 offending images has no direct errors but they all give multiple warnings on rule #38.


 

[miaf][Rule #38] Warning: Tile widths should be a multiple of 64. Found XXX


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


[miaf][Rule #38] Section 7.3.11.4.2
Any grid image in a MIAF file shall also conform to the following constraints:
- The tile_width shall be greater than or equal to 64, and should be a multiple
of 64.
- The tile_height shall be greater than or equal to 64, and should be a multiple
of 64.

 

The offending images are downscaled versions of the same source image. When saving "Preserve Exisiting Tile Size" was enabled.

 

It is worth noting that these are warnings and not errors. It might be worth pursuing a bug with Firefox as well but I think it is important to get your stance on this. This might be a more general aom issue or for 0xC0000054 but I have no clue. It is part of the default install so now I start here.

 

I am unsure if it is a tile issue or that is just a red herring. One offender is attached radio1920x908.avif and I have more samples available at request. This file will fail in Firefox but work in Chrome and Paint.NET.

 

The sob story
I made a HTML file with this image stack:

<img src="img/radio1920x908.png"
     alt=""
     srcset="img/radio5604x2650.avif 5604w,
             img/radio5120x2421.avif 5120w,
             img/radio4096x1937.avif 4096w,
             img/radio3840x1816.avif 3840w,
             img/radio2560x1211.avif 2560w,
             img/radio2048x968.avif  2048w,
             img/radio1920x908.avif  1920w,
             img/radio1920x908.png   1920w,
             img/radio1280x605.avif  1280w,
             img/radio1280x605.png   1280w,
             img/radio640x303.avif    640w,
             img/radio640x303.png     640w,
             img/radio320x151.avif    320w,
             img/radio320x151.png     320w"
     sizes="100vw">

It worked as expected in Chrome. But in Firefox it blanked out for 1920w, 2048w, 3840w and 5604w. In developer tools it looked like the correct versions downloaded properly. The remaining images in the srcset was picked up and displayed properly. The images opened nicely in Paint.NET which I use for images (duh!). Many (many!!!!) hours of trials, debugging and troubleshooting later I finally tried to open the offending images directly in Firefox (right-click open with) and got the error:

Quote

The image [image] cannot be displayed because it contains errors.

The weird thing is that 5604w is an offender as that was the base image and the rest are simply resized versions of that (tiles preserved!). It started as a JPEG and I trimmed the size and removed the background. Then I did the monkey work of resize -> save as avif -> save as png -> repeat x9.

The avif settings was the same each time:

 

Quality: 43
[ ] Lossless
[X] Lossless Alpha Compression
Encoder preset: Medium
Chroma 4:2:0
[X] Preserve Exisiting Tile Size
[X] Premultiplied Alpha

 

I do not have steps to reproduce as such. But I suspect if I save enough images then some will fail in Firefox. If need be I will take the time to do that.

Let me know if I am missing something obvious? Anything else you want me to do etc.?

 

Kind Regards
Claus Andersen

 

P.S. Thank you so much for a fantastic piece of software. I have been happily using it for many years!

Link to comment
Share on other sites

  • Solution

I already replied in the GitHub issue linked to above, but I will post here as well.

 

This issue is due to a bug in Firefox's AVIF decoder, it does not support tiled/grid images.

 

The tile size warning is a red herring, libavif (which is used by Chrome) has no issue decoding tiles that are not a multiple of 64, and it also also ignores the multiple of 64 recommendation when writing grid images.

Even grid images which use a tile size that is a multiple of 64 will fail to open in Firefox, e.g. animals_00_multilayer_grid_a1lx.avif from the official AVIF test suite.

  • Upvote 2

PdnSig.png

Plugin Pack | PSFilterPdn | Content Aware Fill | G'MICPaint Shop Pro Filetype | RAW Filetype | WebP Filetype

The small increase in performance you get coding in C++ over C# is hardly enough to offset the headache of coding in the C++ language. ~BoltBait

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...