strukturag / libheif

libheif is an HEIF and AVIF file format decoder and encoder.
Other
1.78k stars 306 forks source link

Reading animated AVIF fails with error: Unsupported file-type: Unspecified: File does not include any supported brands. #377

Open andrius4669 opened 4 years ago

andrius4669 commented 4 years ago

When trying to read animated AVIF file Chimera-AV1-10bit-480x270.avif from https://github.com/AOMediaCodec/av1-avif repository with heif-info, it fails with error:

$ heif-info Chimera-AV1-10bit-480x270.avif
MIME type: image/avif-sequence
Could not read HEIF/AVIF file: Unsupported file-type: Unspecified: File does not include any supported brands.

This file opens fine in gwenview (with qt-avif-image-plugin installed) and also chromium. Also note that image/avif-sequence was removed from spec, see https://github.com/AOMediaCodec/av1-avif/issues/59 and https://github.com/AOMediaCodec/av1-avif/pull/86.

To reproduce:

git clone https://github.com/AOMediaCodec/av1-avif
cd av1-avif/testFiles/Netflix/avis
heif-info Chimera-AV1-10bit-480x270.avif

OS: ArchLinux x86_64 libheif version: 1.9.1 aom version: 2.0.0 dav1d version: 0.7.1 ImageMagick issue which led to me making this issue: https://github.com/ImageMagick/ImageMagick/issues/2788 Relevant tree at the time of writing this issue: https://github.com/AOMediaCodec/av1-avif/tree/3fb01d066368fc09d86651c1034bcb7a84ca0715/testFiles/Netflix/avis

lovell commented 3 years ago

I tried this image with the proposed change in PR #419, which does help with some "avis" branded AVIF images, but it is missing a pitm (primary item) box.

$ heif-convert Chimera-AV1-10bit-480x270.avif out.png
Could not read HEIF/AVIF file: Invalid input: No 'pitm' box
farindk commented 3 years ago

Proper support for AVIS will require much more work and we also have to extend the API for that. I never understood the need for another container for video formats. Maybe someone can enlighten me why this makes sense?

lorenries commented 2 years ago

One compelling use case for AVIF image sequences is on-the-fly image transformation services that convert animated GIFs to AVIF depending on the requester's Accept header.

Many downstream image transformation services rely on libheif via libvips, so a feature like this could potentially save a lot of bandwidth globally.

bradh commented 12 months ago

We could kind-of support files that have a heic or hevc compatible brand.

For example, with the test file that is linked over at #949

$ heif-info ~/starfield_animation.heic 
MIME type: image/heif-sequence
main brand: msf1
compatible brands: msf1, hevc, heic, mif1, iso8

image: 256x144 (id=1003), primary
  colorspace: YCbCr, 4:2:0
  bit depth: 8
  color profile: no
  alpha channel: no 
  depth channel: no
metadata:
  none
transformations:
  none
region annotations:
  none
properties:

That file is both an image (top level meta) and a movie (top level moof).

Compatible brand is essentially "if you can handle this, you'll be able to get something from the file", so possibly our checks would be more accurate if we parsed all of the compatible brands and not just the major brand. Its a little slower though.

mrmason commented 4 months ago

We are looking to replace our image serving service from webp to AVIF, and have bumped into this problem where animations converted seem to have all of the layers in the image, but the image won't play the animation in any browser.

This issue is blocking both libvips: https://github.com/libvips/libvips/issues/3629 and imagemagick: https://github.com/ImageMagick/ImageMagick/issues/6380 from supporting animation on AVIF which seems like a pretty big deal, seeing these are widely used image libraries for converting images on the web.

bn-c commented 1 month ago

+1

BrentHuang commented 1 week ago

+1

It is very necessary to support avif animations.

Avif is much smaller than gif, which can significantly reduce the CDN traffic overhead of a website.

libvips and imagemagick depend on libheif.

ivanjaros commented 1 week ago

4 years already...

bradh commented 1 week ago

4 years already...

This is unfriendly and unhelpful.

There is work planned (and some of it has already been done, just recently). We'd all like it to happen.However image sequences are quite different to images (in terms of ISOBMFF structure), and exposing them in a consistent, stable API needs a lot of changes to libheif.

Most of this work is being done by Dirk, and quite a lot of it on his own time. So unless you're making contibutions (in any way - code, financial sponsorship, community building, documentation), you aren't really helping. In some ways, making noise (especially negative noise) on a ticket is actually delaying getting it done. You aren't motivating, but rather demotivating, and that isn't OK.

So instead, look at how you could help.

ghnp5 commented 1 week ago

This is unfriendly and unhelpful.

Absolutely. I keep seeing this behavior in several projects...

Are they even donating?? I doubt. They're just entitled.

Thank you very much for all your hard work.

farindk commented 1 week ago

No worries. I have apps in the Android PlayStore. I am used to much worse comments. I couldn't care less anymore. :-) This is a small, but loud minority.