chafa icon indicating copy to clipboard operation
chafa copied to clipboard

Replace ImageMagick with FFmpeg?

Open ndren opened this issue 2 years ago • 4 comments

I have seen thoughts on removing ImageMagick for performance reasons floating around. That sounds quite nice! I am thinking about how that would impact the vast array of file formats that chafa supports through it (AVIF comes to mind). Fortunately, FFmpeg does support a lot of these (at least in git), and certainly all that I've used!

Would FFmpeg be of suitable performance? From what I can tell, it can do codec work it can do much more efficiently than ImageMagick, but I'm not sure if that translates well to chafa. What do you think?

For reference: magick identify -list format ffmpeg -list-formats

ndren avatar Jul 17 '22 18:07 ndren

Yes, ffmpeg would be an improvement over ImageMagick for many reasons. And at this point we have enough direct loaders that ffmpeg could be optional, so you wouldn't be forced to go hunting for devel packages.

Tangentially, I've been trying to get away from big, complex dependencies because they cause problems like the one we currently have with FreeType. It causes a circular dependency (Chafa -> FreeType -> Harfbuzz -> Chafa), which means some distros will build Harfbuzz/hb-view without Chafa support. There are ways to solve this at the distro level, but I don't expect packagers to make a bootstrap build etc. just to accommodate us :-)

So the only long-term solution is to split out the command-line tools from the repository and make a new repository called chafa-util or something like that. Then we can go hog wild with dependencies there.

hpjansson avatar Jul 19 '22 01:07 hpjansson

@ndren By the way, are you using any of the fancy loaders from ImageMagick? AVIF, anything else? Just to get an idea of what's useful.

hpjansson avatar Jul 19 '22 01:07 hpjansson

@hpjansson No, not really. I thought of webp, but that seems to be already explicitly covered.

ndren avatar Jul 21 '22 13:07 ndren

I added AVIF support and removed ImageMagick. Still on the fence re. ffmpeg :-)

hpjansson avatar Sep 17 '23 15:09 hpjansson