Post

Oh gosh, yes. Video decoders for games is one hell of a complex topic. For a start: patents are everywhere and not free. If you want to decode a 4K video with bare normal framerate (even on modern hardware), you can't do it without paying a patent to someone. You just can't. (cont.)

31 reposts65 likes

AV1 and VP9 do "run" everywhere (and AV1 pretty much is VP9 with a moustache). It's not a format problem. The problem is the availability of code/decoders to reliably use a single format across all platforms with non-choppy framerate. To this day, there is no "one to rule them all" situation.

The current state of things makes it so a format will either run extremely poorly (because the platform doesn't provide hardware acceleration for this format), or require code exclusive to each platforms to be written (so hardware acceleration can be used).

Ultimately you end up using multiple formats and multiple decoders, and you have to recode your video player for each of those pairs. When you have PC, Android, iOS, PS5, Xbox, Switch, etc. to do, it's pretty fast a big mess. People don't realize how something like VLC is a marvel of engineering.

hey thomas! hope you're well. i'm working on a bigger story about video codecs, also for game developer. would you be up for answering a few follow up questions about your thread here? can do email, dms, discord, etc. thanks a ton in advance!

Decoding is freaking expensive, you really need something like a GPU or a special chip to reach decent framerate. Problem: that relies on patents, and someone must pay for them. Players pay. When you buy a console, part of its price is made of the patent costs to decode video on a special chip.

Okay, so what? Each and every console already pays a patent for devs to decode videos for free, cool? Unless that demands devs to code a different video decoder for each platforms because each of them has a different way to use that special chip. That's a lot of work, and really sucks.

Genuine good faith question: why CANT devs use ffmpeg to transcode to different formats for each platform? Do the platforms not provide a way to play their blessed format? Why are devs having to write decoders?

ffmpeg is not a decoder, it's a wrapper around existing decoders. For example, you don't need ffmpeg and its gazillion dependencies when you can just use dav1d directly to decode AV1 (which ffmpeg is a wrapper of). It doesn't make things faster (just slightly slower and much bigger).

So as a gamedev, you generally end up looking for a video codec that you could use on ALL platforms with the same code, but you can't use those special chips. So that means using a codec only on the CPU. Long story short, no codec reliably can, and even 1080p can be a big problem.

So you either do like Godot and stick to sucky codec like theora, because that works everywhere (but really sucks, think 2000 divx with limited resolution)... or you go AV1 that will work only on high-end PC (but clearly not consoles unless you down sample a lot).

Seen recently that there was patent litigation on h264 because of course there is And even av1 which at the start was SPECIFICALLY pitched as "free of this bullshit" (and the "alliance of open media") And then Dolby and others decided 7 or 8 years in to go on a witch hunt. Abolish sw patents!!!!!

Side note... curious how Xbox Series/PS5 don't have AV1 decoding??? (Since those GPU archs they can do it ?) Switch 1 IDK, that chip is more than 10 years old at this point I would expect Switch 2 can handle it tho? (And Android can, but probably not all smartphones, and iOS... IDK 😅)