Hacker News
points by Dwedit 10 hours ago | 0 comments
One uncommonly used feature of H.264 is support for lossless video. It's a bit hard to use due to tooling (not easy to discover and select the feature), and is sometimes incompatible with web browsers, but you can get actual lossless video using a mainstream video codec. You can verify that it really is lossless, and doesn't have any conversion step where it's quantized to 8-bit YUV.

"x264vfw" is one tool which supports this format, even inside of an AVI file. So older software that uses Video For Windows can create those files.

[–] ledoge 10 hours ago
FYI, both VP9 and AV1 support lossless as part of their base profiles, so lossless files using those codecs should be compatible with all implementations (at least in theory). Though those profiles only support 4:2:0, so it depends on your use case if that really counts as lossless.
[–] Dylan16807 9 hours ago
I struggle to think of a situation where the blur of chroma subsampling is acceptable but very high quality or prores isn't good enough, I need lossless.
[–] Dwedit 9 hours ago
4:2:0 is not lossless. 4:4:4 with quantizing down to 8-bit YCbCr isn't lossless either. But 10-bit 4:4:4 is reversible back to 8-bit RGB without loss.
[–] thunderfork 5 hours ago
There's a distinction to be made between lossless (compression) and lossless (bit depth/gamma/yadda yadda); typically the format conversion isn't considered part of the "lossy/lossless" distinction.

Definitely not something to be forgotten if you're expecting to compress lossless RGB, although this is pretty rare outside of niche-ish use cases (afaik game capture is basically the only place where people are likely to be using RGB and not YCbCr? could be wrong!)

[–] Dwedit 3 hours ago
Animation production (2D or 3D) can also have raw RGB frames.
[–] thunderfork 1 hour ago
Ah, I hadn't considered that but that totally makes sense!
[–] doublepg23 10 hours ago
What is the purpose of lossless H.264 vs. ProRes or the like?

Is it similar to lossless audio were there's not a ton of optimization you can do?

[–] shellac 10 hours ago
I've attempted to get researchers to use lossless H.264 to encode CT scans. They typically use directories full of tiffs. Even with intra-slice compression (i.e. tiff compression) they are pretty huge. But H.264 will let you recover the original images to the individual bit, and save a huge amount of space thanks to inter-slice similarities.

They are still using directories of tiff, though.

[–] jedbrooke 8 hours ago
I’d imagine the main drawback of using H.264 here is that you’d still have to decode to get the frames back. This is similar to how even though many consumer grade cameras will output natively to h.264, if you want to edit the videos from it you’d usually have to convert it to prores or something first (the editor would usually do this automatically behind the scenes)

I’m not sure if lossless h.264 is I only or not, but if it uses inter-frame compression then it’s difficult to randomly access arbitrary frames. For any arbitrary frame you’d have to find the nearest key frame, then interpolate from there based on the inter-frame compression metadata.

[–] freeone3000 10 hours ago
Lots of hardware requires specifically h.264 as a transit; many of the MPEG standards are built around it. So this lets you get MPEG-PS, or lossless BDs, or some hardware/specialized software decoders for machines that otherwise couldn’t keep up (like set top boxes).
[–] Sopel 10 hours ago
prores is not lossless. It's also an intraframe codec so compression is not great.
[–] ErroneousBosh 6 hours ago
It depends what you mean by "not great". Prores's compression is far better than say H.264, if you actually want usable footage for editing.
[–] Sopel 9 hours ago
you can easily record lossless h264 via obs and any ffmpeg-backed player will play it just fine

the days where the OS matters for video playback are long gone