Opened 5 weeks ago

Last modified 5 weeks ago

#10962 new defect

Unable to create transparent avif with libsvtav1

Reported by: Jozef Chutka Owned by:
Priority: normal Component: undetermined
Version: 6.1.1 Keywords:
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

Summary of the bug:

I am trying to produce transparent .avif using svt-av1, but the process fails with "Second stream for AVIF (alpha) output must have exactly one plane" which seems to be ffmpeg message.

Interestingly the very same command works ok with aom-av1:

How to reproduce:

ffmpeg -i colorkey.webp -filter_complex "[0]split[v][v1];[v1]alphaextract[v1]" -map "[v]" -map "[v1]" -f avif -vcodec libaom-av1 -y out.avif
ffmpeg -i colorkey.webp -filter_complex "[0]split[v][v1];[v1]alphaextract[v1]" -map "[v]" -map "[v1]" -f avif -vcodec libsvtav1 -y out.avif

The first command works ok, the second one with libsvtav1 fails with:

ffmpeg version 6.1.1 Copyright (c) 2000-2023 the FFmpeg developers
  built with Apple clang version 15.0.0 (clang-1500.1.0.2.5)
  configuration: --prefix=/opt/homebrew/Cellar/ffmpeg/6.1.1_4 --enable-shared --enable-pthreads --enable-version3 --cc=clang --host-cflags= --host-ldflags='-Wl,-ld_classic' --enable-ffplay --enable-gnutls --enable-gpl --enable-libaom --enable-libaribb24 --enable-libbluray --enable-libdav1d --enable-libharfbuzz --enable-libjxl --enable-libmp3lame --enable-libopus --enable-librav1e --enable-librist --enable-librubberband --enable-libsnappy --enable-libsrt --enable-libssh --enable-libsvtav1 --enable-libtesseract --enable-libtheora --enable-libvidstab --enable-libvmaf --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libxvid --enable-lzma --enable-libfontconfig --enable-libfreetype --enable-frei0r --enable-libass --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopenvino --enable-libspeex --enable-libsoxr --enable-libzmq --enable-libzimg --disable-libjack --disable-indev=jack --enable-videotoolbox --enable-audiotoolbox --enable-neon
  libavutil      58. 29.100 / 58. 29.100
  libavcodec     60. 31.102 / 60. 31.102
  libavformat    60. 16.100 / 60. 16.100
  libavdevice    60.  3.100 / 60.  3.100
  libavfilter     9. 12.100 /  9. 12.100
  libswscale      7.  5.100 /  7.  5.100
  libswresample   4. 12.100 /  4. 12.100
  libpostproc    57.  3.100 / 57.  3.100
Input #0, webp_pipe, from 'colorkey.webp':
  Duration: N/A, bitrate: N/A
  Stream #0:0: Video: webp, yuva420p(tv, bt470bg/unknown/unknown), 128x128, 25 fps, 25 tbr, 25 tbn
Stream mapping:
  Stream #0:0 (webp) -> split:default
  split -> Stream #0:0 (libsvtav1)
  alphaextract:default -> Stream #0:1 (libsvtav1)
Press [q] to stop, [?] for help
Svt[info]: -------------------------------------------
Svt[info]: SVT [version]:       SVT-AV1 Encoder Lib v1.8.0
Svt[info]: SVT [build]  :       Apple LLVM 15.0.0 (clang-1500.1.0.2.5)   64 bit
Svt[info]: LIB Build date: Dec 14 2023 12:33:03
Svt[info]: -------------------------------------------
Svt[info]: Number of logical cores available: 8
Svt[info]: Number of PPCS 107
Svt[info]: [asm level on system : up to neon]
Svt[info]: [asm level selected : up to neon]
Svt[info]: -------------------------------------------
Svt[info]: SVT [config]: main profile   tier (auto)     level (auto)
Svt[info]: SVT [config]: width / height / fps numerator / fps denominator               : 128 / 128 / 25 / 1
Svt[info]: SVT [config]: bit-depth / color format                                       : 8 / YUV420
Svt[info]: SVT [config]: preset / tune / pred struct                                    : 10 / 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 / rate factor                                         : CRF / 35 
Svt[info]: -------------------------------------------
Svt[info]: -------------------------------------------
Svt[info]: SVT [version]:       SVT-AV1 Encoder Lib v1.8.0
Svt[info]: SVT [build]  :       Apple LLVM 15.0.0 (clang-1500.1.0.2.5)   64 bit
Svt[info]: LIB Build date: Dec 14 2023 12:33:03
Svt[info]: -------------------------------------------
Svt[info]: Number of logical cores available: 8
Svt[info]: Number of PPCS 107
Svt[info]: [asm level on system : up to neon]
Svt[info]: [asm level selected : up to neon]
Svt[info]: -------------------------------------------
Svt[info]: SVT [config]: main profile   tier (auto)     level (auto)
Svt[info]: SVT [config]: width / height / fps numerator / fps denominator               : 128 / 128 / 25 / 1
Svt[info]: SVT [config]: bit-depth / color format                                       : 8 / YUV420
Svt[info]: SVT [config]: preset / tune / pred struct                                    : 10 / 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 / rate factor                                         : CRF / 35 
Svt[info]: -------------------------------------------
[avif @ 0x15af35010] Second stream for AVIF (alpha) output must have exactly one plane
[out#0/avif @ 0x15af34f50] Could not write header (incorrect codec parameters ?): Invalid argument
Error while filtering: Invalid argument

Attachments (1)

colorkey.webp (4.6 KB ) - added by Jozef Chutka 5 weeks ago.

Download all attachments as: .zip

Change History (4)

by Jozef Chutka, 5 weeks ago

Attachment: colorkey.webp added

comment:1 by pdr0, 5 weeks ago

alpha channel is not supported for libsvtav1

Supported pixel formats: yuv420p yuv420p10le

comment:2 by Gyan, 5 weeks ago

@pdr0 - AV1 itself does not support alpha - AVIF requires a 2nd stream containing one luma component only.

To the OP, svtav1 does not support encoding gray, so use AOM for the alpha stream:

ffmpeg -i colorkey.webp -filter_complex "[0]split[v][v1];[v1]alphaextract[v1]" -map "[v]" -map "[v1]" -f avif -c:v:0 libsvtav1 -c:v:1 libaom-av1 -y out.avif

comment:3 by Jozef Chutka, 5 weeks ago

I have opened the issue on SVT-AV1 system https://gitlab.com/AOMediaCodec/SVT-AV1/-/issues/2170

Note: See TracTickets for help on using tickets.