Skip to content

Unable to decode avif images encoded by ffmpeg via av1_qsv #2922

@a15355447898a

Description

@a15355447898a

I got this avif image through this ffmpeg

[ayaya@arch-a380 avif压缩测试]$ find . -type f \( -iname '*.jpg' -o -iname '*.jpeg' -o -iname '*.png' -o -iname '*.tif' \) -print0 | while IFS= read -r -d '' f; do   out="${f%.*}.avif";   echo "Converting (Intel GPU): $f -> $out";    ffmpeg -nostdin -y -init_hw_device qsv=qsv:hw -filter_hw_device qsv -i "$f"     -vf "format=p010,hwupload=extra_hw_frames=64"     -c:v av1_qsv     -global_quality 25     -preset medium     "$out";  done
Converting (Intel GPU): ./neko.jpg -> ./neko.avif
ffmpeg version n8.0.1 Copyright (c) 2000-2025 the FFmpeg developers
  built with gcc 15.2.1 (GCC) 20251112
  configuration: --prefix=/usr --disable-debug --disable-static --disable-stripping --enable-amf --enable-avisynth --enable-cuda-llvm --enable-lto --enable-fontconfig --enable-frei0r --enable-gmp --enable-gnutls --enable-gpl --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libdav1d --enable-libdrm --enable-libdvdnav --enable-libdvdread --enable-libfreetype --enable-libfribidi --enable-libglslang --enable-libgsm --enable-libharfbuzz --enable-libiec61883 --enable-libjack --enable-libjxl --enable-libmodplug --enable-libmp3lame --enable-libopencore_amrnb --enable-libopencore_amrwb --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libplacebo --enable-libpulse --enable-librav1e --enable-librsvg --enable-librubberband --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libssh --enable-libsvtav1 --enable-libtheora --enable-libv4l2 --enable-libvidstab --enable-libvmaf --enable-libvorbis --enable-libvpl --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxcb --enable-libxml2 --enable-libxvid --enable-libzimg --enable-libzmq --enable-nvdec --enable-nvenc --enable-opencl --enable-opengl --enable-shared --enable-vapoursynth --enable-version3 --enable-vulkan
  libavutil      60.  8.100 / 60.  8.100
  libavcodec     62. 11.100 / 62. 11.100
  libavformat    62.  3.100 / 62.  3.100
  libavdevice    62.  1.100 / 62.  1.100
  libavfilter    11.  4.100 / 11.  4.100
  libswscale      9.  1.100 /  9.  1.100
  libswresample   6.  1.100 /  6.  1.100
Input #0, image2, from './neko.jpg':
  Duration: 00:00:00.04, start: 0.000000, bitrate: 9547 kb/s
  Stream #0:0: Video: mjpeg (Baseline), yuvj420p(pc, bt470bg/unknown/unknown), 1091x681 [SAR 72:72 DAR 1091:681], 25 fps, 25 tbr, 25 tbn
Stream mapping:
  Stream #0:0 -> #0:0 (mjpeg (native) -> av1 (av1_qsv))
[swscaler @ 0x7d70c81079c0] deprecated pixel format used, make sure you did set range correctly
Output #0, avif, to './neko.avif':
  Metadata:
    encoder         : Lavf62.3.100
  Stream #0:0: Video: av1 (av01 / 0x31307661), qsv(pc, bt470bg/unknown/unknown, progressive), 1091x681 [SAR 1:1 DAR 1091:681], q=2-31, 25 fps, 12800 tbn (default)
    Metadata:
      encoder         : Lavc62.11.100 av1_qsv
[out#0/avif @ 0x5f54aed79cc0] video:42KiB audio:0KiB subtitle:0KiB other streams:0KiB global headers:0KiB muxing overhead: 0.654496%
frame=    1 fps=0.0 q=-0.0 Lsize=      42KiB time=00:00:00.00 bitrate=N/A speed=   0x elapsed=0:00:00.04   

But the image can't be parsed by avifdec

❯ avifdec neko-gpu.avif test_gpu.png
Decoding with codec 'dav1d' (20 worker threads), please wait...
ERROR: Failed to parse image: Not implemented
Diagnostics:
 * Box[pixi] contains unsupported plane count [0]

Images encoded with ffmpeg+svt-av1 can be parsed normally.

❯ find . -type f \( -iname '*.jpg' -o -iname '*.jpeg' -o -iname '*.png' -o -iname '*.tif' \) -print0 |
while IFS= read -r -d '' f; do
  out="${f%.*}.avif"
  echo "Converting: $f -> $out"

  ffmpeg -nostdin -y -i "$f" \
    -c:v libsvtav1 -crf 30 -preset 6 \
    -svtav1-params avif=1 -pix_fmt yuv420p10le -color_range pc \
    "$out"

done
Converting: ./neko.jpg -> ./neko.avif
ffmpeg version n8.0.1 Copyright (c) 2000-2025 the FFmpeg developers
  built with gcc 15.2.1 (GCC) 20251112
  configuration: --prefix=/usr --disable-debug --disable-static --disable-stripping --enable-amf --enable-avisynth --enable-cuda-llvm --enable-lto --enable-fontconfig --enable-frei0r --enable-gmp --enable-gnutls --enable-gpl --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libdav1d --enable-libdrm --enable-libdvdnav --enable-libdvdread --enable-libfreetype --enable-libfribidi --enable-libglslang --enable-libgsm --enable-libharfbuzz --enable-libiec61883 --enable-libjack --enable-libjxl --enable-libmodplug --enable-libmp3lame --enable-libopencore_amrnb --enable-libopencore_amrwb --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libplacebo --enable-libpulse --enable-librav1e --enable-librsvg --enable-librubberband --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libssh --enable-libsvtav1 --enable-libtheora --enable-libv4l2 --enable-libvidstab --enable-libvmaf --enable-libvorbis --enable-libvpl --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxcb --enable-libxml2 --enable-libxvid --enable-libzimg --enable-libzmq --enable-nvdec --enable-nvenc --enable-opencl --enable-opengl --enable-shared --enable-vapoursynth --enable-version3 --enable-vulkan
  libavutil      60.  8.100 / 60.  8.100
  libavcodec     62. 11.100 / 62. 11.100
  libavformat    62.  3.100 / 62.  3.100
  libavdevice    62.  1.100 / 62.  1.100
  libavfilter    11.  4.100 / 11.  4.100
  libswscale      9.  1.100 /  9.  1.100
  libswresample   6.  1.100 /  6.  1.100
Input #0, image2, from './neko.jpg':
  Duration: 00:00:00.04, start: 0.000000, bitrate: 9547 kb/s
  Stream #0:0: Video: mjpeg (Baseline), yuvj420p(pc, bt470bg/unknown/unknown), 1091x681 [SAR 72:72 DAR 1091:681], 25 fps, 25 tbr, 25 tbn
Stream mapping:
  Stream #0:0 -> #0:0 (mjpeg (native) -> av1 (libsvtav1))
[swscaler @ 0x5586ec016ac0] deprecated pixel format used, make sure you did set range correctly
Svt[info]: -------------------------------------------
Svt[info]: SVT [version]:	SVT-AV1 Encoder Lib v3.1.2-dirty
Svt[info]: SVT [build]  :	GCC 15.2.1 20250813	 64 bit
Svt[info]: LIB Build date: Aug 28 2025 13:59:13
Svt[info]: -------------------------------------------
Svt[warn]: TPL is disabled for avif
Svt[info]: Level of Parallelism: 5
Svt[info]: Number of PPCS 2
Svt[info]: [asm level on system : up to avx2]
Svt[info]: [asm level selected : up to avx2]
Svt[info]: -------------------------------------------
Svt[info]: SVT [config]: main profile	tier (auto)	level (auto)
Svt[info]: SVT [config]: width / height / fps numerator / fps denominator 		: 1096 / 688 / 25 / 1
Svt[info]: SVT [config]: bit-depth / color format 					: 10 / YUV420
Svt[info]: SVT [config]: preset / tune / pred struct 					: 6 / PSNR / random access
Svt[info]: SVT [config]: gop size / mini-gop size / key-frame type 			: 161 / 32 / key frame
Svt[info]: SVT [config]: BRC mode / CQP Assignment 					: CQP / 30 
Svt[info]: SVT [config]: AQ mode / Variance Boost 					: 2 / 0
Svt[info]: SVT [config]: sharpness / luminance-based QP bias 				: 0 / 0
Svt[info]: -------------------------------------------
SvtMalloc[info]: SVT Memory Usage:
SvtMalloc[info]:     total allocated memory:       70.92 MB
SvtMalloc[info]:         malloced memory:          22.30 MB
SvtMalloc[info]:         callocated memory:        6.06 MB
SvtMalloc[info]:         allocated aligned memory: 42.56 MB
SvtMalloc[info]:     mutex count: 578
SvtMalloc[info]:     semaphore count: 207
SvtMalloc[info]:     thread count: 59
SvtMalloc[info]:     hash table fulless: 0.002747, hash bucket is healthy
SvtMalloc[info]: top 10 malloced memory locations:
SvtMalloc[info]: (3.81 MB): /usr/src/debug/svt-av1/SVT-AV1/Source/Lib/Codec/bitstream_unit.c:36
SvtMalloc[info]: (2.90 MB): /usr/src/debug/svt-av1/SVT-AV1/Source/Lib/Codec/coding_unit.c:109
SvtMalloc[info]: (2.71 MB): /usr/src/debug/svt-av1/SVT-AV1/Source/Lib/Codec/pcs.c:1088
SvtMalloc[info]: (1.98 MB): /usr/src/debug/svt-av1/SVT-AV1/Source/Lib/Codec/md_process.c:264
SvtMalloc[info]: (1.24 MB): /usr/src/debug/svt-av1/SVT-AV1/Source/Lib/Codec/md_process.c:307
SvtMalloc[info]: (1.24 MB): /usr/src/debug/svt-av1/SVT-AV1/Source/Lib/Codec/md_process.c:306
SvtMalloc[info]: (915.33 KB): /usr/src/debug/svt-av1/SVT-AV1/Source/Lib/Codec/md_process.c:348
SvtMalloc[info]: (830.06 KB): /usr/src/debug/svt-av1/SVT-AV1/Source/Lib/Codec/pcs.c:577
SvtMalloc[info]: (636.75 KB): /usr/src/debug/svt-av1/SVT-AV1/Source/Lib/Codec/md_process.c:310
SvtMalloc[info]: (636.75 KB): /usr/src/debug/svt-av1/SVT-AV1/Source/Lib/Codec/md_process.c:311
Output #0, avif, to './neko.avif':
  Metadata:
    encoder         : Lavf62.3.100
  Stream #0:0: Video: av1 (av01 / 0x31307661), yuv420p10le(pc, bt470bg/unknown/unknown, progressive), 1091x681 [SAR 1:1 DAR 1091:681], q=2-31, 25 fps, 12800 tbn (default)
    Metadata:
      encoder         : Lavc62.11.100 libsvtav1
[out#0/avif @ 0x55872e0e7b40] video:15KiB audio:0KiB subtitle:0KiB other streams:0KiB global headers:0KiB muxing overhead: 1.850181%
frame=    1 fps=0.0 q=30.0 Lsize=      15KiB time=00:00:00.00 bitrate=N/A speed=   0x elapsed=0:00:00.36    
SvtMalloc[info]: you have no memory leak
❯ avifdec neko-cpu.avif test_gpu.png
Decoding with codec 'dav1d' (20 worker threads), please wait...
Image decoded: neko-cpu.avif
 * Resolution     : 1091x681
 * Bit Depth      : 10
 * Format         : YUV420
 * Chroma Sam. Pos: 0
 * Alpha          : Absent
 * Range          : Full
 * Color Primaries: 2
 * Transfer Char. : 2
 * Matrix Coeffs. : 5
 * ICC Profile    : Absent
 * XMP Metadata   : Absent
 * Exif Metadata  : Absent
 * Transformations: None
 * Progressive    : Unavailable
 * Gain map       : Absent
 * 1 timescales per second, 1.00 seconds (1 timescales), 1 frame
 * Frame:
   * Decoded frame [0] [pts 0.00 (0 timescales)] [duration 1.00 (1 timescales)] [1091x681]
Wrote PNG: test_gpu.png

The test files are as follows
avif压缩测试.zip

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions