View Full Version : Question about lossy and lossless
errantkkn
20th August 2014, 14:00
Hi all, I have some troubles of understanding lossy and lossless video.
For ex:
I encode raw source A1 to B1 through lossy method.
Then when decoding B1 I have raw A2.
So B1 is lossy of A1 and B1 is lossless of A2, is it right?
If yes, then I encode A2 to B2 through lossless method, but It'll never touch the size of B1. I can not understand this.
Please help me, thank you guys :D
microchip8
20th August 2014, 14:13
no it's not right
if you encode raw A1 to lossy B1, you'll get a compressed video (lossy). Decoding of B1 does not imply that you get true raw video (without modifications compared to raw A1) since B1 is compressed and the decoder decodes the compressed video. You cannot go from compressed video to raw video which is exactly the same as the original raw input.
Note that raw video can mean two things: either it's truly raw without any compression or it's a compressed raw video which is extracted from a container
errantkkn
20th August 2014, 15:14
Thank froggy1.
I know that A2 will be different from A1. I just mean decoding B1 we'll have something call A2.
So, as you said, A2 is not a raw? Is it still compressed?
I have one more question. Does decoding a lossy video with different decoders bring different results?
Thank you.
poisondeathray
20th August 2014, 15:26
So, as you said, A2 is not a raw? Is it still compressed?
I have one more question. Does decoding a lossy video with different decoders bring different results?
Thank you.
A2 is uncompressed video decoded from B1, not the same thing as "raw" by any definition . A2 has same image quality as B1. But B1 has already incurred generation loss and is not equivalent to A1
Note in the video world "raw" has a very different meaning than in "anime" world.
Decoding lossy video (in theory) should result in same results with different decoders . But sometimes there are problems with decoders, shortcuts taken, errors in code
LoRd_MuldeR
20th August 2014, 15:26
Thank froggy1.
I know that A2 will be different from A1. I just mean decoding B1 we'll have something call A2.
So, as you said, A2 is not a raw? Is it still compressed?
I have one more question. Does decoding a lossy video with different decoders bring different results?
Thank you.
Put simply, encoding takes "raw" (uncompressed) video data as input and returns some kind of compressed bitstream; decoding takes the compressed bitstream as input and returns "raw" (uncompressed) video data again.
It is possible to convert directly from one compressed format to another compressed format, but "internally" the data will still be decompressed (from the old format) and then compressed again (to the new format).
Now, the compression may be lossy or lossless. With a lossless compression, the "raw" data you get back from the decoder is bit-identical to the "raw" data you once fed into the encoder. With lossy compression that is not the case!
(Be aware though that different pixel formats for "raw" video data exist, such as YCrCb vs. RGB, different sub-sampling or different number of bits per channel. So even lossless compression may include a pixel format conversion!)
Does decoding a lossy video with different decoders bring different results?
In a perfect world, all existing decoders (for a certain compressed format) would produce bit-identical output for the identical compressed input bitstream.
In reality, tough, decoders may contain bugs or not be 100% spec compliant. So you cannot rely on that (although it generally should be the case).
errantkkn
20th August 2014, 16:20
Very interesting, thank you all.
So in conclusion:
A -->encoding--> B -->decoding--> A :lossless
A -->encoding--> B -->decoding--> C :lossy
But I'm thinking of this:
A1 -->lossy_encoding--> lossy_B1
lossy_B1 -->decoding--> A2 (different from A1)
A2 -->lossless_encoding--> lossless_B2
Decoding both lossy_B1 & lossless_B2 will bring the same A2
But in reality, lossy_B1 < lossless_B2.
So if we want to save A2 on HDD, lossy_B1 is better.
In similar, for the raw A1, maybe there's a lossy_B0 that when decoding it, we'll have exactly A1. And this will be the perfect compress method (lossy_B0 < lossless_B0)
:stupid: Is it right? Forgive me if this is a noob thinking.
poisondeathray
20th August 2014, 16:29
Yes that's right
"lossless" always refers to comparing to the uncompressed video state. A compressed video has to be decompressed (decoded) to uncompressed before it's recompressed.
So lossless compression will always yield larger filesize , when the source is already lossy compressed.
asarian
28th August 2014, 09:52
Speaking of lossless, how lossless is encoding with "-QP 0" really?
I have a project that requires several passes, with lossless intermediate steps. Will "-QP 0" do it?
Thanks.
asarian
28th August 2014, 09:54
n/a /5
feisty2
28th August 2014, 11:47
qp 0 is mathematically lossless, identical to totally lossless
vBulletin® v3.8.11, Copyright ©2000-2025, vBulletin Solutions Inc.