Log in

View Full Version : Lossless Mode


KanarazuKatsu
20th October 2018, 01:59
Hello experts,

I wanted to test out the lossless mode --lossless from x265 on original (not encoded) sources; however, the output file is so much larger than the original file itself. I have no idea how this happens and was wondering what I am doing wrong, or something that I am unaware of.

Here is the command line used: ffmpeg -i source -c:v libx265 -x265-params lossless=1 output.mkv

Thanks!

-Note: I know here for ffmpeg, the command line doesn't use --lossless, but please instruct me how to use pipeline x265 lossless as well if you have time. Thanks again!

FranceBB
20th October 2018, 03:21
the output file is so much larger than the original file itself.

If sources are lossy, it's normal.
A lossless encode will always produce a big file, 'cause x265 won't use the DCT transform and it will bypass quantization.
The only thing it will do will be prediction, so frames will be Intra or Inter and, just like in normal encodes, the slower the preset is, the more accurate the research will be, the less space it will require. (It will still be huge, though).
That process is called motion-compensation.
For instance x265.exe --preset veryslow --lossless will use less bitrate than x265.exe --preset ultrafast --lossless
In order to see the real compression benefits of x265 lossless you can encode a file to UTVideo, to HuffYUV and to HEVC lossless, you'll notice that the reduction of bitrate of x265 is somewhat significant for a lossless encode compared to HuffYUV and UTVideo.
Keep in mind that "lossless" and "visually lossless" are two very different things.
Lossless files are generally used as mezzanine in order to do a second encode later with a different software and so on; they are not suited for archive unless you have a very big storage.
Visually lossless files are just files encoded using "good enough" lossy compression settings that produce something that "looks" like they didn't lose any details, but they did.

KanarazuKatsu
20th October 2018, 03:48
If sources are lossy, it's normal.
A lossless encode will always produce a big file, 'cause x265 won't use the DCT transform and it will bypass quantization.
The only thing it will do will be prediction, so frames will be Intra or Inter and, just like in normal encodes, the slower the preset is, the more accurate the research will be, the less space it will require. (It will still be huge, though).
That process is called motion-compensation.
For instance x265.exe --preset veryslow --lossless will use less bitrate than x265.exe --preset ultrafast --lossless
In order to see the real compression benefits of x265 lossless you can encode a file to UTVideo, to HuffYUV and to HEVC lossless, you'll notice that the reduction of bitrate of x265 is somewhat significant for a lossless encode compared to HuffYUV and UTVideo.
Keep in mind that "lossless" and "visually lossless" are two very different things.
Lossless files are generally used as mezzanine in order to do a second encode later with a different software and so on; they are not suited for archive unless you have a very big storage.
Visually lossless files are just files encoded using "good enough" lossy compression settings that produce something that "looks" like they didn't lose any details, but they did.

Hmm, but how did this user manage to get a smaller loss-less file compared to the source?

https://www.texpion.com/2018/07/av1-vs-vp9-vs-avc-h264-vs-hevc-h265-1-lossless.html

He did this using a few different video codecs.

Thank you for the explanation up above though! ^^

poisondeathray
20th October 2018, 04:19
Hmm, but how did this user manage to get a smaller loss-less file compared to the source?

https://www.texpion.com/2018/07/av1-vs-vp9-vs-avc-h264-vs-hevc-h265-1-lossless.html

He did this using a few different video codecs.



Source was uncompressed (Y4M )

The "lossless" aspect is with respect to the uncompressed state .

So if you start with a compressed video, it has to be decoded first (uncompressed) , then re-compressed . That's why it's so much larger than "normal" lossy compressed videos, but smaller than uncompressed video

KanarazuKatsu
20th October 2018, 05:40
Source was uncompressed (Y4M )

The "lossless" aspect is with respect to the uncompressed state .

So if you start with a compressed video, it has to be decoded first (uncompressed) , then re-compressed . That's why it's so much larger than "normal" lossy compressed videos, but smaller than uncompressed video

Ahh, okay. Thank you very much for that explanation.