AOMediaCodec / libavif

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

Does it not support converting BMP images to AVIF format #1877

Open zhuya1996 opened 7 months ago

zhuya1996 commented 7 months ago

Does it not support converting BMP images to AVIF format ,thanks

y-guyon commented 7 months ago

The avifenc binary only supports the JPG, PNG and Y4M input formats for now. See https://github.com/AOMediaCodec/libavif/tree/main/apps/shared.

You may use a third party tool to either convert from BMP to one of these supported formats and then use avifenc, or use software that can convert from BMP directly to AVIF. I can think of recent versions of Photoshop, GIMP, ImageMagick, ffmpeg.

zhuya1996 commented 7 months ago

avifenc二进制文件目前仅支持 JPG、PNG 和 Y4M 输入格式。请参见https://github.com/AOMediaCodec/libavif/tree/main/apps/shared。

您可以使用第三方工具从 BMP 转换为这些受支持的格式之一,然后使用avifenc,或者使用可以从 BMP 转换为 AVIF 的软件。我可以想到 Photoshop、GIMP、ImageMagick、ffmpeg 的最新版本。

Can you directly convert YUV images to AVIF? thanks

y-guyon commented 7 months ago

I think .yuv files (plain raw samples with no container) are supported in libaom for example but not in libavif. They are inconvenient because they do not contain any metadata (image width, height, subsampling etc.) and these fields must be passed explicitly as command line arguments.

I do not know any software converting directly from YUV to AVIF, sorry.

zhuya1996 commented 7 months ago

I think .yuv files (plain raw samples with no container) are supported in libaom for example but not in libavif. They are inconvenient because they do not contain any metadata (image width, height, subsampling etc.) and these fields must be passed explicitly as command line arguments.

I do not know any software converting directly from YUV to AVIF, sorry.

May I ask if you know how to use avif_example_encode.c Can you help me write a demo for encoding. c to read JPG images and convert them to AVIF and save them locally

y-guyon commented 7 months ago

See the following test for a small snippet to start with:

https://github.com/AOMediaCodec/libavif/blob/e107e095f1ada7c9de872ccdbbf556816e2e37a5/tests/gtest/avifencodetest.cc#L19-L29

zhuya1996 commented 7 months ago

See the following test for a small snippet to start with:

https://github.com/AOMediaCodec/libavif/blob/e107e095f1ada7c9de872ccdbbf556816e2e37a5/tests/gtest/avifencodetest.cc#L19-L29

Thank you very much for trying it out

zhuya1996 commented 7 months ago

See the following test for a small snippet to start with:

https://github.com/AOMediaCodec/libavif/blob/e107e095f1ada7c9de872ccdbbf556816e2e37a5/tests/gtest/avifencodetest.cc#L19-L29 Hello, I was unsuccessful. Can you give me a compressed file that can run VS2022? My email 2308193190@qq.com

zhuya1996 commented 7 months ago

See the following test for a small snippet to start with: https://github.com/AOMediaCodec/libavif/blob/e107e095f1ada7c9de872ccdbbf556816e2e37a5/tests/gtest/avifencodetest.cc#L19-L29

Hello, I was unsuccessful. Can you give me a compressed file that can run VS2022? My email 2308193190@qq.com

QQ截图20231215131419 The exe I compiled using this code encountered an error Failed to read input image: BMFF parsing failed

y-guyon commented 7 months ago

The exe I compiled using this code encountered an error Failed to read input image: BMFF parsing failed

Functions starting with avifDecoderRead*() in the libavif API are designed to decode AVIF files.
inputFilename seems to contain the path to [input.png]. Please use avifReadImage() instead.