Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion. Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules. |
11th October 2014, 22:27 | #1 | Link |
Registered User
Join Date: Oct 2014
Posts: 10
|
lossless encoding and file size
Hi,
I read on this thread that a lossless codec will always result in a larger file size. I don't understand this statement. The purpose of a codec is to compress data - how would throwing computing power at a compression problem _worsen_ the situation? Winzip achieves lossless compression, and I don't think I've ever seen it produce a larger file size. |
12th October 2014, 02:04 | #2 | Link | |
Registered User
Join Date: Sep 2005
Location: Vancouver
Posts: 600
|
Quote:
It's because your source is already highly compressed. To recompress it with a lossless codec, it first needs to be decompressed into raw video. Which is also what happens when you play back the file. Small lossy video file -> enormous uncompressed video -> giant lossless video file |
|
23rd October 2014, 12:09 | #3 | Link |
Registered User
Join Date: Oct 2014
Posts: 10
|
I had to think a bit about this.
I thought that lossless codecs achieved greater compression because they removed information from the source. Uncompressing a lossless file does not 'add' information to the file, so couldn't a lossless compression of 'x' bits have potentially a smaller file size of a losslessly compressed file that also has 'x' bits of information? (I agree that given the same file, the lossy codec should produce a smaller file size than a lossless codec, but that's not exactly what is happening here). |
23rd October 2014, 22:21 | #5 | Link |
Registered User
Join Date: Feb 2002
Location: San Jose, California
Posts: 4,407
|
Lossy codecs do achieve their greater compression efficiency by removing information from the source but it isn't as simple as that either.
The decompressing step for video generates exactly as much new information as was removed during the lossy compression. The goal is to get the generated image to look as much like the original (to us) while needing as little information as possible. Lossy video compression builds a mathematical model that generates a video frame. None of the actual raw video data is stored, only matrix coefficients for equations which when decoded generate a similar looking image. It is like the difference between saying red if X² + Y² = 100² and saying pixel 1 = black, pixel 2 = black ... pixel 50 = red, pixel 51 = black, etc. across 10000 pixels to describe a 100 pixel radius red circle. Except the equations only approximate the image, they do not capture any part of it exactly. |
24th October 2014, 08:08 | #6 | Link | |
Registered User
Join Date: Aug 2008
Location: Isle of Man
Posts: 588
|
Quote:
|
|
20th December 2014, 12:43 | #7 | Link |
Registered User
Join Date: Oct 2014
Posts: 10
|
Riffraff42, what part of entropy specifically?
Asmodian, I don't think that decompressing would generate as much new information (otherwise the codec would be lossless). Where I think I have gone wrong in my thinking is that I came from the basis of losslessly compressing the _already compressed_ file. After reading a bit about entropy, I actually think that it would be possible to losslessly compress an already lossy compressed filed, as I doubt that a lossy compression would reach the theoretical maximum of information per bit as provided by Shannon's theorem. However, I don't think that using a lossless codec on this compressed file (if this could even be done - transcoding involves decompressing the lossy file first to 'raw' format) would work. The lossless codec is designed to work with the properties of a 'raw' video input... trying to apply the same codec to a lossy compressed video wouldn't provide good results as the characteristics of the data (the lossy compressed video) is different to what the lossless codec was designed for. |
21st December 2014, 04:24 | #8 | Link | ||
Registered User
Join Date: Feb 2002
Location: San Jose, California
Posts: 4,407
|
Quote:
It is very easy to know how much information raw video data is. Simply the number of pixels, the color depth, and the frame rate. Quote:
|
||
21st December 2014, 12:37 | #9 | Link | |
Angel of Night
Join Date: Nov 2004
Location: Tangled in the silks
Posts: 9,559
|
Quote:
Compatibility is so much more important that most of these techniques never get any traction, though; people just update to newer standards as they appear. |
|
24th December 2014, 12:17 | #10 | Link | |
Registered User
Join Date: Oct 2014
Posts: 10
|
Quote:
In an extreme case, if the codec 'compressed' the video stream by replacing each pixel with a black pixel, then the information content would be zero (even though the number of pixels is the same as the raw video). |
|
1st January 2015, 11:40 | #11 | Link | |
Registered User
Join Date: Oct 2014
Posts: 10
|
Quote:
My video camera spits out h.264 in real time. The mental picture I have is that the encoding configuration on the video camera results in an acceptable quality to file size ratio, with the constraint that the encoding must be done in *real time*. If the real time constraint was lifted, then presumably you'd be able to use more processing power to bring down the file size without any loss of quality (kind of like the speed of compression options in the zip utility), up to some maximum compression ratio (bounded by Shannon's theorem). However, we don't have the original raw data in order to re-run the compression with more processing time. What may be useful could be a codec that takes in already compressed input, and further (losslessly) compresses it, with the end result being the same as what you would have obtained had you thrown more processing power (with the same codec parameters) at the raw data. Not sure if there's any theoretical limits to implementing something like this... Given the continuing fall in cost of storage, I don't think there's much of an incentive to implement either. It just irks me that a 5 minute video takes up 450MB of storage... |
|
2nd January 2015, 08:32 | #12 | Link | |
Registered User
Join Date: Mar 2011
Posts: 4,829
|
Quote:
|
|
5th January 2015, 01:14 | #14 | Link | |
Angel of Night
Join Date: Nov 2004
Location: Tangled in the silks
Posts: 9,559
|
Quote:
Now, you can probably accept near-lossless for blocks that are never referenced in the future, which would help a lot, since being referenced means any tiny deviations start to stack up. To cut size and processing time, maybe you're willing to accept barely-perceptible stacked distortions, at which point you're just re-encoding anyway. It's a hard problem for very small gain, although not an impossible one. It's more research-paper material than practical, since near-lossless re-encoding is good enough for almost everyone. |
|
5th January 2015, 10:56 | #15 | Link | |
Registered User
Join Date: Oct 2014
Posts: 10
|
Quote:
|
|
16th January 2015, 13:04 | #16 | Link | |
Registered User
Join Date: Feb 2002
Posts: 970
|
Quote:
It doesnt serve to store files, but to create intermediate filtered videos to feed to a compressor, In fact it is a losseless decompression just smaller than pure RGB decompression |
|
16th January 2015, 13:30 | #17 | Link | |
Registered User
Join Date: Mar 2009
Location: Germany
Posts: 5,769
|
Quote:
Starting from a single source a lossless codec will always require more space than a lossy one, as the lossy one can only achieve this level of compression only by throwing away some of the original information. Having a compressed source, the same applies. Decompressing the file will result in a file which is again less compressed by a lossless codec than by a lossy one. Because a lossless codec does not look to throw away any information, the resulting compressed file may be slightly smaller (compared to the file that would result by compressing the original file) but definitely larger than any other compressed files. Therefore in both cases a losslessly compressed file would be larger.
__________________
Born in the USB (not USA) |
|
Tags |
lossless compression |
|
|