Log in

View Full Version : Using "CABAC" for lossless compression of DVDs?


gods_rifle
29th September 2009, 20:39
Hi,
re-inspired by the Thread "CAVLC -> CABAC" in the "MPEG-4 AVC / H.264" section, i have a few questions about an idea i had.
First of all i have to admit that i'm no expert at all in video-encoding (so maybe these are kind of dumb questions).

The idea is following:

If i'm not entirely wrong, the last step of an mpeg2 encoder is huffman coding (or entropy coding in general).
Is it possible to recompress mpeg2 files in an lossless (bit-identical? / visually lossless?) way with decompressing (only the entropy-coding) the mpeg2 stream and recompress it with a somewhat more modern algorithmn like CABAC or simply Arithmetic-Coding/Range-Coding?
I think some kind of that idea is used in recompressing JPEGs (in 7-Zip, PAQ or special programs)
These recompressed files shouldn't be played before reversing the steps above.

My observation is, that general-purpose (high speed) compression programs like 7-Zip can compress mpeg2 streams (DVDs) with maybe 80% - 95% of the original size without decompressing it (at least i assume these programs are not doing that).

So the questions are:

- is it possible to do without losing quality?
-> i don't know enough about mpeg2 encoder implementations, but i think if i process a mpeg2 file with the steps above, then later want to reverse these steps, it's maybe possible thats the bitstream isn't identical in a bitwise way, but in the visual way

- is it possible or a good idea to use CABAC?
-> seems to be a general-purpose arithmetic coding tool for me

- do you think there will be some worthwile compression gain?

I'm very curious about your opinions!
Thanks!

Dark Shikari
29th September 2009, 20:57
Hi,
re-inspired by the Thread "CAVLC -> CABAC" in the "MPEG-4 AVC / H.264" section, i have a few questions about an idea i had.
First of all i have to admit that i'm no expert at all in video-encoding (so maybe these are kind of dumb questions).

The idea is following:

If i'm not entirely wrong, the last step of an mpeg2 encoder is huffman coding (or entropy coding in general).
Is it possible to recompress mpeg2 files in an lossless (bit-identical? / visually lossless?) way with decompressing (only the entropy-coding) the mpeg2 stream and recompress it with a somewhat more modern algorithmn like CABAC or simply Arithmetic-Coding/Range-Coding?Yes.I think some kind of that idea is used in recompressing JPEGs (in 7-Zip, PAQ or special programs)
These recompressed files shouldn't be played before reversing the steps above.You might as well just write a small module for an MPEG-2 decoder that handles it; no point in decoding, then re-compressing, on playback.
y observation is, that general-purpose (high speed) compression programs like 7-Zip can compress mpeg2 streams (DVDs) with maybe 80% - 95% of the original size without decompressing it (at least i assume these programs are not doing that).You can get much more than that. MPEG-2's VLC tables are notoriously inefficient, even compared to non-arithmetic-coded formats.- is it possible or a good idea to use CABAC? Yes. CABAC will do the job, though CABRC might also be an option (ffmpeg's range coder).

eslave
24th October 2009, 01:28
My observation is, that general-purpose (high speed) compression programs like 7-Zip can compress mpeg2 streams (DVDs) with maybe 80% - 95% of the original size without decompressing it (at least i assume these programs are not doing that).

With respect to those compression numbers I've noticed a lot of mpegs have padding packets (all nulls) to maintain the overall bitrate for older set-top DVD players, often constituting up to 10-15% of the overall filesize (look for 0x000001be). These padding packets together with repetitive system headers and other duplicate pack-header information (perhaps up to 2% or more) may be where 7-Zip and other archivers are achieving the majority of such compression results, not to mention subtitles.

-eslave