Opened 15 months ago

Last modified 15 months ago

#10220 new defect

AVIF image's alpha track is not being found

Reported by: Meten Owned by:
Priority: normal Component: undetermined
Version: unspecified Keywords: av1 libaom-av1
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description (last modified by Meten)

Summary of the bug:
ffmpeg/ffprobe don't show or can't "see" that there is a 2nd alpha track for an AVIF image that does have one.

How to reproduce:
Create an AVIF image with an alpha layer
(Using avifenc to create a new AVIF file in a similar fashion will yield similar results)

% ffmpeg -hide_banner -i icon.png -c:v libaom-av1 -cpu-used 0 -still-picture true -crf:0 56 -crf:1 40 -filter_complex 'split[rgb],alphaextract[a]' -pix_fmt:0 yuv420p -map '[rgb]' -map '[a]' newicon.avif

Try to do anything with it like e.g. convert it back to a PNG, and FFmpeg will complain:

% ffmpeg -hide_banner -i newicon.avif -filter_complex "[0:v:1][0:v:0]alphamerge[out]" -map '[out]' out.png
[libdav1d @ 000002a98be16e00] libdav1d 1.1.0-0-g9593e62
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'newicon.avif':
  Metadata:
    major_brand     : avif
    minor_version   : 0
    compatible_brands: avifmif1miafMA1B
  Duration: N/A, start: 0.000000, bitrate: N/A
  Stream #0:0[0x1]: Video: av1 (Main), yuv420p(tv, unknown/bt709/iec61966-2-1), 184x184 [SAR 1:1 DAR 1:1], 1 fps, 1 tbr, 1 tbn
Stream specifier ':v:1' in filtergraph description [0:v:1][0:v:0]alphamerge[out] matches no streams.

version used:

ffmpeg version 2023-02-22-git-d5cc7acff1-full_build-www.gyan.dev Copyright (c) 2000-2023 the FFmpeg developers
built with gcc 12.2.0 (Rev10, Built by MSYS2 project)
configuration: --enable-gpl --enable-version3 --enable-static --disable-w32threads --disable-autodetect --enable-fontconfig --enable-iconv --enable-gnutls --enable-libxml2 --enable-gmp --enable-bzlib --enable-lzma --enable-libsnappy --enable-zlib --enable-librist --enable-libsrt --enable-libssh --enable-libzmq --enable-avisynth --enable-libbluray --enable-libcaca --enable-sdl2 --enable-libaribb24 --enable-libdav1d --enable-libdavs2 --enable-libuavs3d --enable-libzvbi --enable-librav1e --enable-libsvtav1 --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs2 --enable-libxvid --enable-libaom --enable-libjxl --enable-libopenjpeg --enable-libvpx --enable-mediafoundation --enable-libass --enable-frei0r --enable-libfreetype --enable-libfribidi --enable-liblensfun --enable-libvidstab --enable-libvmaf --enable-libzimg --enable-amf --enable-cuda-llvm --enable-cuvid --enable-ffnvcodec --enable-nvdec --enable-nvenc --enable-d3d11va --enable-dxva2 --enable-libvpl --enable-libshaderc --enable-vulkan --enable-libplacebo --enable-opencl --enable-libcdio --enable-libgme --enable-libmodplug --enable-libopenmpt --enable-libopencore-amrwb --enable-libmp3lame --enable-libshine --enable-libtheora --enable-libtwolame --enable-libvo-amrwbenc --enable-libilbc --enable-libgsm --enable-libopencore-amrnb --enable-libopus --enable-libspeex --enable-libvorbis --enable-ladspa --enable-libbs2b --enable-libflite --enable-libmysofa --enable-librubberband --enable-libsoxr --enable-chromaprint
libavutil      58.  3.100 / 58.  3.100
libavcodec     60.  4.100 / 60.  4.100
libavformat    60.  4.100 / 60.  4.100
libavdevice    60.  2.100 / 60.  2.100
libavfilter     9.  4.100 /  9.  4.100
libswscale      7.  2.100 /  7.  2.100
libswresample   4. 11.100 /  4. 11.100
libpostproc    57.  2.100 / 57.  2.100

Interestingly, ffprobe does show the alpha track for animated AVIF files. Example:

% ffprobe -hide_banner animated_logo.avif
[libdav1d @ 0000018448b99140] libdav1d 1.1.0-0-g9593e62
[libdav1d @ 0000018448b9a780] libdav1d 1.1.0-0-g9593e62
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '.\animated_logo.avif':
  Metadata:
    major_brand     : avis
    minor_version   : 0
    compatible_brands: avisavifmsf1iso8mif1miafMA1B
  Duration: 00:00:01.40, start: 0.000000, bitrate: 69 kb/s
  Stream #0:0[0x1](und): Video: av1 (Main) (av01 / 0x31307661), yuv420p(tv, progressive), 256x256 [SAR 1:1 DAR 1:1], 14 kb/s, 15 fps, 15 tbr, 100k tbn (default)
    Metadata:
      handler_name    : PictureHandler
      vendor_id       : [0][0][0][0]
      encoder         : Lavc60.4.100 libaom-av1
  Stream #0:1[0x2](und): Video: av1 (Main) (av01 / 0x31307661), gray(pc, gbr/unknown/unknown, progressive), 256x256 [SAR 1:1 DAR 1:1], 42 kb/s, 15 fps, 15 tbr, 100k tbn
    Metadata:
      handler_name    : PictureHandler
      vendor_id       : [0][0][0][0]
      encoder         : Lavc60.4.100 libaom-av1
[libdav1d @ 0000018448b9b400] libdav1d 1.1.0-0-g9593e62
[libdav1d @ 0000018448b8aac0] libdav1d 1.1.0-0-g9593e62

Attachments (2)

icon.png (5.2 KB ) - added by Meten 15 months ago.
PNG file used
newicon.avif (1.3 KB ) - added by Meten 15 months ago.
Resulting AVIF file from the command

Download all attachments as: .zip

Change History (3)

by Meten, 15 months ago

Attachment: icon.png added

PNG file used

by Meten, 15 months ago

Attachment: newicon.avif added

Resulting AVIF file from the command

comment:1 by Meten, 15 months ago

Description: modified (diff)
Note: See TracTickets for help on using tickets.