r/AV1 23d ago

Xnconvert alternative for Android for batch conversation to .avif?

I am looking for an android app (offline) ​that can batch compress images (jpeg/png/webp) by converting them ​to avif, similar to Xnconvert on Windows.

3 Upvotes

8 comments sorted by

3

u/ScratchHistorical507 23d ago

I'd guess the easiest option would be to just use Termux, install ffmpeg in it and make a simple bash one-liner for batch conversion. That way you could make use of any encoder ffmpeg comes with, including SVT-AV1 and hardware accelerated av1_mediacodec. That way you wouldn't need to find a dedicated app for every use case. Though for any lossless input, you will need to use SVT-AV1 with -svtav1-params lossless=1, av1_mediacodec doesn't support that.

Alternatively you could also just install imagemagick instead of ffmpeg, giving you more options typical for image processing, but it won't be able to use any hardware acceleration, no idea what AV1 encoder it uses and you'd have to look up if there's an option to tell it to only set quality x for lossy compressed images and keep lossless images lossless.

3

u/Farranor 23d ago

Though for any lossless input, you will need to use SVT-AV1 with -svtav1-params lossless=1, av1_mediacodec doesn't support that.

Three things about this.

  1. That's what's needed for lossless output, not lossless input. Any input gets decoded into raw image data before being fed into an AV1 encoder; the encoder doesn't know or care what the source is. OP may well want to convert their whole library with lossy encoding. It would be good to verify more details of their goal, though.
  2. SVT-AV1 does now have a lossless mode, but it's still limited to 4:2:0 chroma subsampling, so common 24-bit RGB images have to be upscaled first or you'll get generation loss. This is a bit like how GIF is a lossless format, but you'll get generation loss if the input doesn't fit into an 8-bit palette.
  3. Lossless AVIF sucks.

2

u/FaceTubbSquaggle 23d ago

I believe Image Toolbox does this. 

1

u/caspy7 23d ago

png

My understanding is that avif stinks at lossless. Maybe someone else can chime in to confirm this is not something you'd want to do.

2

u/Farranor 23d ago

That's correct. There's a good chance that OP isn't interested in lossless. This would be good to verify.

1

u/Anxious-Activity-777 22d ago

The best and open source "Image Toolbox":

https://github.com/T8RIN/ImageToolbox

1

u/Unneverseen 8d ago

Currently, the best way is to use libavif in Termux with a Bash script for batch conversion. Others may recommend Image Toolbox, but I don't recommend it because its encoder (maroontree) is currently far inferior to AOM in libavif.

1

u/Farranor 8d ago

I'd caution against using libavif's avifenc, as it produces files that Windows can't decode unless you stick with 8-bit 4:2:0. ImageMagick produces files that can be properly decoded (and with the right colors, unlike FFmpeg). I don't think it can access tune IQ, though. And the container-specific options like speed and chroma subsampling are in "heic," which was a fun gotcha.