Hacker News new | ask | show | jobs
by jcampbell1 3193 days ago
I do a lot of video stuff, and I have no idea what lossless compression is. What does it mean? Does it mean not using a resolution higher than the player is presented on the screen? Does it mean setting a sensible minimum CRF in x264?
5 comments

Lossless compression is where you reduce the file size without removing the audio / video data. Where as lossy compression is where you reduce the file size by reducing the audio / video content (typically using methods that are non-obvious to observers)

An easy but somewhat crude comparison would be a text file that reads:

“Space,” it says, “is big. Really big. You just won’t believe how vastly, hugely, mindbogglingly big it is. I mean, you may think it’s a long way down the road to the chemist’s, but that’s just peanuts to space.”

Lossless would be putting that content into a ZIP file (eg winzip / 7zip / etc).

Where as lossy would be rewriting the passage to something like:

“Space is really big. You just won’t believe how vastly, hugely, mindbogglingly big it is. You may think it’s a long way down the road to the chemist’s, but that’s just peanuts to space.”

Generally lossy compression will yield better compression because you can vastly reduce the information you need to compress and then apply lossless techniques as well.

Lossless means lossless, i.e. you have no loss of information. The decompressed video is exactly what you had when you started. It's PNG (lossless) vs. JPG (lossy) or FLAC (lossless) vs. MP3 (lossy).

Of course lossless compression is typically a lot less compact than lossy alternatives (the article mentions a 1/2 compression ration, which is not much compared to lossy video codecs) but it means you're not degrading your video at all, you just have additional processing.

Note that some algorithms these days claim to be "visually lossless" which is mainly a marketing gimmick which means that it's lossy but you wouldn't be able to tell the difference with the naked eye in normal conditions (TICO claims that for instance).

> Does it mean setting a sensible minimum CRF in x264?

In ffmpeg, -qp 0 will get you lossless x264. I use it all the time (via OBS) to losslessly record my screen.

Lossless means that the data is compressed on a bit-level. Has nothing todo with encoding. Similar to WinRAR and ZIP, it probably uses a compression algorithm specific to cloudflare storage to serve the video faster?
You can have lossless compressors tailor-made for specific applications who will typically achieve a better compression ratio than the "generic" compression algorithms WinRAR, ZIP and friends use.

For instance try zip'ing a WAV file and compare it to the same file encoded in FLAC. Typically FLAC will achieve better compression while still being lossless.

There are lossless video codecs, like VC-2 for instance. It's not very common in the consumer world however because people generally don't want to stream or store high definition video with a single digit compression factor (that single digit being generally around 2).

--cq 0