AOMediaCodec / libavif

libavif - Library for encoding and decoding .avif files
Other
1.52k stars 191 forks source link

Odd image dimentions and svt-av1 encoder #544

Open novomesk opened 3 years ago

novomesk commented 3 years ago

SVT encoder doesn't like odd image dimensions:

-------------------------------------------
SVT [version]:  SVT-AV1 Encoder Lib v0.8.6
SVT [build]  :  GCC 9.3.0        64 bit
LIB Build date: Jan 11 2021 09:20:51
-------------------------------------------
Error Instance 1: Source Width must be even for YUV_420 colorspace
Error Instance 1: Source Height must be even for YUV_420 colorspace
SvtMalloc[info]: you have no memory leak

How to deal with the situation? 1) Add 1 pixel column/row to the image (in application level) and define avifCleanApertureBox? 2) Can libavif automate actions in 1) ? 3) Wait, maybe future version of SVT-AV1 brings some solution.

joedrago commented 3 years ago

This is definitely something for SVT to implement, just like the other AV1 implementations.

kingsznhone commented 1 month ago

This is a reallly annoy problem while i'm trying to archive some odd length image

wantehchang commented 1 month ago

Hi @kingsznhone,

I assume your input images are in the YUV 4:2:0 format.

You can use avifenc with libaom as the AV1 encoder. libaom supports 4:2:0 input images of odd dimensions.

If you prefer SVT-AV1 as the AV1 encoder, you can use heif-enc (from libheif). heif-enc pads the image to even dimensions and then adds a clean aperture (clap) property to the AVIF file to crop the padded image to the original size. (This is solution 1 in https://github.com/AOMediaCodec/libavif/issues/544#issue-832697009.)