Skip to content

(re)build libheif with X265 encoder instead of kvazaar#61

Merged
viralauraframes merged 1 commit intomasterfrom
use_x265_not_kvazaar
Mar 16, 2026
Merged

(re)build libheif with X265 encoder instead of kvazaar#61
viralauraframes merged 1 commit intomasterfrom
use_x265_not_kvazaar

Conversation

@jtomson
Copy link

@jtomson jtomson commented Mar 11, 2026

imgproxy is generating larger-than-expected heif images, with the wrong profile

imgproxy builds its own libheif, and uses something called the kvazaar library to encode. This causes heics to be encoded as large-ish videos of one frame with the Main HEVC profile , instead of using the Main Still Picture HEVC profile

The base image builds the libheif:

https://github.com/imgproxy/imgproxy-docker-base/blob/9095a2cbb6128571fd4e047f1175db1881302954/build-deps.sh#L317-L328

Not sure if re-building it like this is more or less maintainable than forking the base image too, but modifying the compile options seems to do the trick - generating proper heic files

Copy link
Collaborator

@bantonj bantonj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔥

@jtomson
Copy link
Author

jtomson commented Mar 12, 2026

actually this whole encoding lib diversion may be unnecessary and using quality=50, which is still required used by x265, is the better fix? I'm not sure that the profile (Main vs Main Still Picture) makes a practical impact on size or performance

@bantonj
Copy link
Collaborator

bantonj commented Mar 12, 2026

actually this whole encoding lib diversion may be unnecessary and using quality=50, which is still required used x265, is the better fix? I'm not sure that the profile (Main vs Main Still Picture) makes a practical impact on size or performance

x265 is included in the existing build? It just doesn't always use it?

@jtomson
Copy link
Author

jtomson commented Mar 12, 2026

sorry I meant to say we need to use q=50 regardless of building with x265 (which is not currently used in prod) or kvazaar (currently used in prod)

@viralauraframes
Copy link
Collaborator

I think this is still good to merge. I did some testing and output looks good.

@viralauraframes viralauraframes marked this pull request as ready for review March 13, 2026 14:44
@viralauraframes
Copy link
Collaborator

Merging this.
I did on frame testing on an carver with quality 50 HEIC with the same images as before and the performance was similar to what was before so this change should be good.

@viralauraframes viralauraframes merged commit 054059a into master Mar 16, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants