Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AVIF and AV1 support #2908

Open
Stryxus opened this issue Oct 24, 2024 · 4 comments
Open

AVIF and AV1 support #2908

Stryxus opened this issue Oct 24, 2024 · 4 comments

Comments

@Stryxus
Copy link

Stryxus commented Oct 24, 2024

Is your feature request related to a problem? Please describe.

Too many social media platforms use JPG and h264, and greatly compressed JPG and h264 at that so, why can we not have AVIF and AV1 support? Basically all browsers support it except for AV1 on Safari on older hardware (WebP for compat perhaps?).

I feel like since BlueSky is still relatively new, this would be a great opportunity to onboard AVIF and AV1. It will make for a much better user experience and yes, while people dont like it when something isnt a JPG or PNG when they right click and save the image, its a very small price to pay and, these days, AVIF is very easily convertible anyway. AV1 is another story, right now at least, its somewhat hard to transcode into a more compatible format but then again, it could deter people from downloading every video on the platform while its still young.

On the storage and bandwidth side of BlueSky, this could potentially save quite a lot of money for the platform.

Describe the solution you'd like

An implementation of AVIF, it should make the platform much faster and efficient, as well as preparing the stage for HDR.
This would also be good for if/when users can upload their own GIF's since AVIF supports animations.

Describe alternatives you've considered

For AV1, the only issue is with Safari on 'unsupported' hardware so, VP9 as an alternative for now? This needs discussion.

Additional context

While abandoned now, this is a great comparison tool for AVIF/JPG
Youtube uses AV1 for 8k video on supported hardware.

@surfdude29
Copy link
Contributor

I agree with the general direction of your suggestion, but I disagree on some of the specifics. Fwiw here are my own two cents on the question of next-generation image and video formats on Bluesky.

Although AVIF is a great image format, I think JPEG XL (aka JXL) would be a better option for the canonical versions of still images stored on the user's PDS. My understanding is that image processing is done on the user's device before it's uploaded to the PDS, so it needs to be very quick. Given my own casual experience with the two formats, conversion into JXL seems to be much quicker than AVIF, and you still get a decent file size saving vs. JPEG for the same quality.

While JXL support isn't nearly as common as AVIF today, that will only increase over time now that Apple has decided to throw their weight behind it, and hopefully Mozilla with Firefox will come on board soon too. The CDN could serve JXL versions to clients that support it (I don't know this for sure, but I imagine this could include iOS app users on iOS 17 or higher?) and easily generate JPEG versions for clients that don't yet, which is one of the major benefits of JXL.

AVIF could have a role to play on Bluesky for showing animated images. It can offer huge reductions in file size vs. GIFs and it already has wide support, as you say.

For video on the web, AV1 is undoubtedly the future, but unfortunately I just don't think it's a viable option on Bluesky yet. My understanding is that AV1 encoding is still very compute-intensive and thus takes significantly longer than H.264.

And for display on the end user's device, AV1 hardware decoding – vital for performance and battery life – has only really become widely available in the last couple of years. E.g. on the Apple side of things only the iPhone 15 Pro, iPhone 16 models and Macs with an M3 processor or later have support.

So to me AV1 would look to be attractive to implement on Bluesky in a year or two hopefully, when more users are enjoying Bluesky on devices with AV1 hardware decoding, and when AV1 encoding efficiency has improved enough to close the gap with H.264.

@Stryxus
Copy link
Author

Stryxus commented Oct 25, 2024

Although AVIF is a great image format, I think JPEG XL (aka JXL) would be a better option for the canonical versions of still images stored on the user's PDS. My understanding is that image processing is done on the user's device before it's uploaded to the PDS, so it needs to be very quick. Given my own casual experience with the two formats, conversion into JXL seems to be much quicker than AVIF, and you still get a decent file size saving vs. JPEG for the same quality.

JXL could indeed work, I didn't mention it because the last I saw, about the beginning of the year, was that Chromium removed it very suddenly because had some sort of dispute and a community outcry began. Since then Iv personally been invested in AVIF so 🤷.

For video on the web, AV1 is undoubtedly the future, but unfortunately I just don't think it's a viable option on Bluesky yet. My understanding is that AV1 encoding is still very compute-intensive and thus takes significantly longer than H.264.

And for display on the end user's device, AV1 hardware decoding – vital for performance and battery life – has only really become widely available in the last couple of years. E.g. on the Apple side of things only the iPhone 15 Pro, iPhone 16 models and Macs with an M3 processor or later have support.

So to me AV1 would look to be attractive to implement on Bluesky in a year or two hopefully, when more users are enjoying Bluesky on devices with AV1 hardware decoding, and when AV1 encoding efficiency has improved enough to close the gap with H.264.

This is a good point, I wasnt 100% sure if the transcoding was done on client or server. Ye, only Apple M3 and up as well as NVIDIA's RTX 4000 series support AV1 encoding. The libraries for encoding AV1 seem vast though too. Iv tested NVIDIA's NVENC AV1 on a RTX 4070 Super and it looks to be about half as efficient but MUCH faster than AOM or SVT so, it might be a little bit off still but, good to keep up with it due to the benefits.

@bleonard252
Copy link

AVIF seems better suited for GIF-like images. I think JPEG-XL would be optimal for still images, although it doesn't seem to have nearly any support on the web.

@Tamschi
Copy link

Tamschi commented Nov 5, 2024

It depends on the content. JPEG-XL is better for (perceptually) lossless compression of artistic content and pixel animations.
AVIF is likely to outperform it for lossy compression and reaction GIFs though (since it's basically a video compression scheme).

Afaict, what it comes down to is that JXL has better high-quality compression but no motion vector gradients.


A note on JXL->JPEG: For that to be efficient, you have to use compatibility mode which hurts JXL compression (and possibly accuracy?).
It may be a good idea to use full-featured JXL for anything ATProto and start with the compatibility mode only in the CDN (since that does a lossy recompression anyway).

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

No branches or pull requests

4 participants