FOSDEM / video

81 stars 20 forks source link

Evaluate feasibility of SVT-AV1 #134

Open zeridon opened 5 years ago

zeridon commented 5 years ago

Today in my feed poped a writeup from netflix about SVT-AV1.

Review if feasible for use:

https://medium.com/netflix-techblog/introducing-svt-av1-a-scalable-open-source-av1-framework-c726cce3103a https://github.com/OpenVisualCloud/SVT-AV1/

abitrolly commented 1 year ago

There are at least 3 AV1 mainstream encoders right now (source) and the repo of SVT-AV1 moved.

yoe commented 1 year ago

For reference:

I am planning to experiment with av1 encodes for debconf23 this year. Depending on the results, this might be sufficient to switch fosdem, too.

Will report back when there's more to report about.

yoe commented 10 months ago

FWIW, AV1 has happened for DebConf23 and as a result will likely happen for FOSDEM 2023 as well (with the same or similar settings).

This requires significant CPU time, but I'll talk to server people to figure out what we can do.

yoe commented 10 months ago

Whoops, wrong button.

As an aside, we also figured out how to do AV1 live streams (w/ DASH), and I think it should be possible to do this for FOSDEM as well. You'll want to experiment to make sure, though.

yoe commented 10 months ago

By request, here's a bit of what needs to be done for AV1 at FOSDEM:

For reference, the ffmpeg command line in the debconf video team's ansible repository could, depending on template values, end up being something like this:

ffmpeg -i rtmp://localhost/$app/$name -async 1 -vsync -1 -map 0 -map 0 -map 0:v -c:v libsvtav1 -preset 8 -c:a libopus -crf:v:0 23 -crf:v:1 23 -s:v:1 640x360 -s:v:2 320x180 -b:v:2 192k -maxrate:v:2 256k -b:a:0 128k -b:a:1 64k -adaptation_sets "id=0,streams=v id=1,streams=a" -f dash /path/to/dash/$name/stream.mpd

A bit of an explanation of that:

I ran the example command line on my laptop (Model name: 11th Gen Intel(R) Core(TM) i7-11850H @ 2.50GHz, is what /proc/cpuinfo tells me), and managed to livestream 720p video this way with no issues, and we even still had space on the same machine to also encode H.264 for the HLS stream in our tests.

Obviously different machines may have different requirements; if the used CPU at FOSDEM does not have sufficient CPU power, bumping the -preset value somewhat is advisable. One could also consider playing with the number of encoded streams, but since the other two are scaled down, their CPU requirements are a fraction of the unscaled one so in my experience that wasn't really worth it.

Note: we don't specify -crf:v:2, and we also don't specify -b:v:0, -b:v:1, -maxrate:v:0, nor -maxrate:v:1. This is not an accident and it is not an oversight. If you use -crf, then you set ffmpeg to "constant quality" mode, in which it tries to get a constant video quality while varying bit rate. If you use -b and optionally -maxrate, then you set ffmpeg to "constant bitrate" mode, in which it tries to get a constant video bitrate while varying quality. This is obviously a tradeoff that reasonable people can disagree on reasonably.

So what this all means is:

yoe commented 7 months ago

Everything appearing on video.fosdem.org is transcoded to AV1 for 2024. Since this doesn't need to be a live stream, it uses preset 6 rather than preset 8, but even so the resulting files average about 10 times smaller than the mp4 ones (which are unmodified copies from the live stream).

preset 8 will make the files somewhat larger, but not a whole order of magnitude, so I think it is definitely worth looking into for 2025.