News for hackers. Stuff that matters.
Re:Lepton image compression: saving 22% losslessly from imag... by neuronexmachina on Thursday July 14, 2016 @01:04PM (#12095498)
I'd love to have something like this for archiving DVD ISOs though, where the VOBs are compressed with old-school MPEG.
Re:Lepton image compression: saving 22% losslessly from imag... by astrange on Thursday July 14, 2016 @06:26PM (#12097669)
It wouldn't get much smaller. The reason DVDs are such a high bitrate compared to Handbrake rips isn't that MPEG2 is inefficient, it's because there's a keyframe twice a second. Most movie rips have a keyframe every 10 seconds.

It's mostly to let you fast forward, but there is a technical issue there. MPEG2 decoders aren't all mathematically identical, so what happens is the picture tends to drift away from the real thing after a while, and there's hacks like frequent keyframes and flipping the smallest DCT coefficient to get around it…

Re:Lepton image compression: saving 22% losslessly from imag... by phire on Friday July 15, 2016 @04:54PM (#12103777)
I've always wondered if it would be possible to losslessly convert the MPEG2 DCT coefficients, motion vectors etc to the equivalent subset of h.264 and then take advantage of the better prediction and entropy encoding of the later standard.

Maybe you could even go further and actively remove keyframes (in a fully reversible way, just keep a record of where they were)

I'm not sure how much you would save, and for losslessly archiving DVDs you might be better off creating a special format like Lepton for mpeg2

Re:Lepton image compression: saving 22% losslessly from imag... by niftich on Friday July 15, 2016 @05:00PM (#12103811)
The first part of your question was posed on Doom9 in 2009. It's the opinion of Dark Shikari, longtime lead x264 developer, that it would be possible [1].

Not sure what you mean by the keyframe removal, though. Such an act would be lossy, significantly impair any P-frames or B-frames (unless you majorly modify them), and, it frankly doesn't sound very reversible. Mind elaborating?

[1] http://forum.doom9.org/showthread.php?t=149895

Re:Lepton image compression: saving 22% losslessly from imag... by phire on Saturday July 16, 2016 @09:23PM (#12108607)
What I mean is transforming I-frames into equivalent P-frames (or even B-frames) that decode to the exact same pixels. The transformation might result in something that is bigger than a directly encoded P-frame (which can tolerate some small errors) but I suspect the new P-frame will be smaller than the original I-frame.

There is no restriction that P/B-frames only reference I-frames, so you don't even need to touch those frames.

For conversion back to MPEG2 it would be ideal to detect or mark the original I-Frames, so you can convert them back (a simpler transformation). But you could also pick any random P/B-frame and convert it to an I-frame with little issue.

Re:Lepton image compression: saving 22% losslessly from imag... by dublinben on Thursday July 14, 2016 @01:52PM (#12095916)
Why bother trying to losslessly compress your DVDs when they're already a low quality, compressed MPEG2 source? The small amount of content that isn't available in higher quality won't take up that much space left as is.
Re:Lepton image compression: saving 22% losslessly from imag... by tedunangst on Thursday July 14, 2016 @02:03PM (#12095998)
This is why I come to HN. To find out what's in my video archive and how easy it is to replace.
Re:Lepton image compression: saving 22% losslessly from imag... by antisthenes on Thursday July 14, 2016 @03:09PM (#12096455)
In the case you're being facetious, maybe you could clarify how big is your video archive exactly and what sort of compression you're trying to achieve on it?
Re:Lepton image compression: saving 22% losslessly from imag... by cbhl on Thursday July 14, 2016 @05:34PM (#12097336)
Shouldn't you just use Handbrake and H.264/AAC? (Assuming your computer is fast/new enough to play it back.)
Re:Lepton image compression: saving 22% losslessly from imag... by nacs on Thursday July 14, 2016 @05:53PM (#12097468)
The article (and the person you're replying to) is referring to lossless compression. Converting to H264 and AAC may maintain a high quality at a lower bitrate but they're definitely not lossless.
Re:Lepton image compression: saving 22% losslessly from imag... by gribbly on Thursday July 14, 2016 @05:53PM (#12097474)
I assume he'd want it to be lossless, as is the case with Lepton.
Re:Lepton image compression: saving 22% losslessly from imag... by stephenr on Thursday July 14, 2016 @01:17PM (#12095626)
How does h.264/5 not fit the bill?
Re:Lepton image compression: saving 22% losslessly from imag... by beernutz on Thursday July 14, 2016 @01:42PM (#12095835)
I don't think h.264/5 is bit-for-bit retrievable is it? Neuronexmachina might be wanting to be able to get back the 1:1 version maybe?
Re:Lepton image compression: saving 22% losslessly from imag... by IanCal on Thursday July 14, 2016 @01:39PM (#12095813)
Can you run those losslessly?
Re:Lepton image compression: saving 22% losslessly from imag... by thescriptkiddie on Thursday July 14, 2016 @02:08PM (#12096040)
Re:Lepton image compression: saving 22% losslessly from imag... by niftich on Thursday July 14, 2016 @03:21PM (#12096516)
While there's a lossless H.264, it doesn't fit the implied use-case proposed in the thread. Using lossless H.264 to recompress lossy MPEG-2 would be akin to using PNG to recompress a JPEG -- silly and wasteful.

Sure, it's an inexact analogy because PNG is not a block-based DCT coder, but all lossless H.264 does is set the quantizer as absurdly high as it needs to go to losslessly encode a particular frame. Staring from a compressed source, this is not a good recipe for achieving a space-saving result.