2 ms·
> Isn't the encoding algorithm deterministic There is no "the encoding algorithm" when it comes to video encoding. Think of a video codec as being analogous t
by Youden 6y ago
> Isn't the encoding algorithm deterministic
There is no "the encoding algorithm" when it comes to video encoding.
Think of a video codec as being analogous to HTML. HTML isn't defined as "this is the algorithm for producing a HTML file", it's defined as "these are the things a browser will do when you give it this data". How to combine those things to do what you want is up to you.
It's the same for video: the codec standard doesn't tell you how to encode the video, it tells you what you need to support if you want to _decode_ the video.
So different encoders can encode videos in entirely different ways, even when using the same codec. As such, they can have very different performance characteristics.
As for why a software encoder will provide better quality, it's because a software encoder has luxuries like a high-power general-purpose CPU and copious amounts of memory that allow it to do things that are difficult in dedicated hardware.
A hardware encoder on a mobile device for example will often be a tiny tiny piece of silicon in some corner of the SoC, so it'll have limited physical space for complex logic. It'll also have serious power and thermal constraints. These are things a hardware encoder has to work around that a software encoder doesn't.