View Full Version : Best lossless codec for archiving


PCU
11th July 2021, 02:36
What's the best lossless codec for archiving?

Kurtnoise
11th July 2021, 04:34
Probably FFV1...

FranceBB
11th July 2021, 11:55
Tough choice.
I'm gonna go for x265 --lossless just because it's generally more supported by NLE etc than the alternatives like HuffYUV, Lagarith and UTVideo and it performs well...

kolak
11th July 2021, 12:28
h265 is slow. Also- is playback really that good for anything above 4:2:0 10bit? For archiving you want at least 4:2:2.
FFV1 is used by many institutions as archiving format.

SeeMoreDigital
11th July 2021, 12:32
For me...

Saving to x264 lossless in mkv has always produced reliable results when generating encodes with VirtualDub2.

Jamaika
11th July 2021, 14:55
What kind of movies are we talking about? If new HDR then you can use 10bit HDR. Which codec? That's the problem. Cineform is out. MJPEG2000 is out. The JPEG XS was not seen by anyone. X265 at high bitrate is best in 4K.
Old movies only in RGB. Don't record on Bluray.
Will the AV1, VVC, EVC codecs satisfy the recipient in 20 years? No, then it will be 16K, and we will be able to throw 2K films in the trash.

benwaggoner
12th July 2021, 16:57
What kind of movies are we talking about? If new HDR then you can use 10bit HDR. Which codec? That's the problem. Cineform is out. MJPEG2000 is out. The JPEG XS was not seen by anyone. X265 at high bitrate is best in 4K.
Yep, x265 has the best combination of compression efficiency, content type flexibility, and long-term decodability.

Old movies only in RGB. Don't record on Bluray.
Will the AV1, VVC, EVC codecs satisfy the recipient in 20 years? No, then it will be 16K, and we will be able to throw 2K films in the trash.
I doubt even 8K will be standard in 20 years for consumer viewing. The industry has yet to identify moving image content that customers can discriminate 4K from 8K even in optimal viewing conditions. And as theatrical movies have long been the primary driver of content tech innovation, the lack of any plan (or business model) for 8K projectors will blunt that.

My 2041 vision has HDR 4K with dynamic metadata as the default, probably in H.268.

jpsdr
12th July 2021, 17:32
UTVideo and MagicYUV are good, i'm using them all the time but for intermediate production files. They are fast, but for archiving, there is probably slower codecs with better compression, like x264 or x265 lossless.

benwaggoner
12th July 2021, 18:26
UTVideo and MagicYUV are good, i'm using them all the time but for intermediate production files. They are fast, but for archiving, there is probably slower codecs with better compression, like x264 or x265 lossless.
x265 lossless can be sped up a lot by doing IDR-only (--keyint 1) and using a faster --preset. You can really crank up -F in that case, as each frame is encoded independently. And better yet, you'll get HW decode on modern GPUs, which can give you performance back.

kolak
12th July 2021, 18:28
How much are you going to gain on typical film source (with all grain/noise etc.) using h265 lossless compared to other "fast" codecs?
I never found real world lossless scenario which would give more than 2-2.5x compression (regardless fo the codec).

How difficult would be to do hybrid mode which hits chosen ratio (eg. 3:1), but when it can switches to lossless mode? HDCAM-SR worked this way no?

Thundik81
12th July 2021, 20:16
In most cases, just keep original format!

kolak
12th July 2021, 20:33
I agree, but at some point it's a difference between spending 1MLN$ or 500K$ for archive and then lossless has its argument :)

PCU
12th July 2021, 21:09
x264/265 is not 100% lossless.

benwaggoner
12th July 2021, 21:12
How much are you going to gain on typical film source (with all grain/noise etc.) using h265 lossless compared to other "fast" codecs?
I never found real world lossless scenario which would give more than 2-2.5x compression (regardless fo the codec).

How difficult would be to do hybrid mode which hits chosen ratio (eg. 3:1), but when it can switches to lossless mode? HDCAM-SR worked this way no?
It wouldn't be difficult at all, and allows for VBV compliance for profile @ level. Just use --cu-lossless, and coding units that can be efficiently encoded as lossless get encoded as lossless. Lots of fun info about lossless mode here: https://x265.readthedocs.io/en/master/lossless.html.

And yes, about 2.5:1 for content with grain or other random noise is about what you can expect. Totally clean content in Long GOP can go way, way lower. That's less than you'll get with ProRes and other intermediate codecs. Actual mathematically lossless is rarely needed, and should only be used when it really is. Like delivering VFX with alpha for compositing.

benwaggoner
12th July 2021, 21:12
x264/265 is not 100% lossless.
They are in their lossless modes.

kolak
12th July 2021, 22:19
It wouldn't be difficult at all, and allows for VBV compliance for profile @ level. Just use --cu-lossless, and coding units that can be efficiently encoded as lossless get encoded as lossless. Lots of fun info about lossless mode here: https://x265.readthedocs.io/en/master/lossless.html.

And yes, about 2.5:1 for content with grain or other random noise is about what you can expect. Totally clean content in Long GOP can go way, way lower. That's less than you'll get with ProRes and other intermediate codecs. Actual mathematically lossless is rarely needed, and should only be used when it really is. Like delivering VFX with alpha for compositing.

3:1 is all what you really need.

GMJCZP
13th July 2021, 00:00
x265 lossless can be sped up a lot by doing IDR-only (--keyint 1) and using a faster --preset. You can really crank up -F in that case, as each frame is encoded independently. And better yet, you'll get HW decode on modern GPUs, which can give you performance back.

In Simple X264 I try to code with X265 lossless and I can only pass in custom parameters --keyint 1 --lossless. I can't pass a preset, what am I doing wrong?

Edit: I am using x265 version 3.2, is that why?

rwill
13th July 2021, 07:30
x265 lossless can be sped up a lot by doing IDR-only (--keyint 1) and using a faster --preset. You can really crank up -F in that case, as each frame is encoded independently. And better yet, you'll get HW decode on modern GPUs, which can give you performance back.

HEVC higher levels @High Tier have a minimum compression ratio base requirement of 4 so good luck with that HW decode.

Asmodian
13th July 2021, 23:09
My favorite lossless codec is MagicYUV. Very fast.

benwaggoner
13th July 2021, 23:53
HEVC higher levels @High Tier have a minimum compression ratio base requirement of 4 so good luck with that HW decode.
Yeah, it comes out as High Tier Level 8.something. So far, the HW decoders I've tried seem to work okay. Not having to deal with interframe prediction saves a whole lot of work.

GMJCZP
14th July 2021, 01:40
In Simple X264 I try to code with X265 lossless and I can only pass in custom parameters --keyint 1 --lossless. I can't pass a preset, what am I doing wrong?

Edit: I am using x265 version 3.2, is that why?

I would like to experience the lossless option of x265 but I can't get past the "presets" option, any ideas?

PCU
14th July 2021, 10:53
I would like to experience the lossless option of x265 but I can't get past the "presets" option, any ideas?

Do you use Adobe Media Encoder?

GMJCZP
14th July 2021, 11:58
In Simple X264 I try to code with X265 lossless and I can only pass in custom parameters --keyint 1 --lossless. I can't pass a preset, what am I doing wrong?

Edit: I am using x265 version 3.2, is that why?

For third time I say it.

benwaggoner
14th July 2021, 17:18
Here's everything you ever wanted to know about lossless: https://x265.readthedocs.io/en/master/lossless.html

tl;dr, use the --lossless parameter. It's been supported since before 2.0. 3.2 is nothing.

GMJCZP
14th July 2021, 17:39
Here's everything you ever wanted to know about lossless: https://x265.readthedocs.io/en/master/lossless.html

tl;dr, use the --lossless parameter. It's been supported since before 2.0. 3.2 is nothing.

Thanks. In post #9 (https://forum.doom9.org/showthread.php?p=1947372#post1947372) you said that to speed up the encoding you can use presets (I don't know if I misunderstood) but I have tried to pass it in Simple x264 and it only accepts --keyint 1 --lossless

benwaggoner
14th July 2021, 19:28
Thanks. In post #9 (https://forum.doom9.org/showthread.php?p=1947372#post1947372) you said that to speed up the encoding you can use presets (I don't know if I misunderstood) but I have tried to pass it in Simple x264 and it only accepts --keyint 1 --lossless
I mean the speed/quality tradeoffs enabled by --preset. --preset ultrafast is much, much faster than --preset placebo. Since in lossless, the quality is by definition identical, using a slower, higher quality preset will make the HEVC encode smaller.

The right tradeoff really depends on your use case. I'll use --placebo if I'm uploading a file that lots of people will download. I'd perhaps use --faster if it's just a scratch file for immediate use.

GMJCZP
14th July 2021, 23:11
Thanks, I understand this a little more, it was not necessary in Simplex264 to pass --fast or --placebo, you can place the Preset directly and just pass --keyint 1 --lossless. I will read the documentation anyway.

Edit: Is the quality the same, even though the file size varies according to the selected preset?

benwaggoner
15th July 2021, 01:16
Thanks, I understand this a little more, it was not necessary in Simplex264 to pass --fast or --placebo, you can place the Preset directly and just pass --keyint 1 --lossless. I will read the documentation anyway.

Edit: Is the quality the same, even though the file size varies according to the selected preset?
If you don't specify a preset, x264 will just use the default values. Which are generally sane and will give a pretty reasonable quality/speed tradeoff.

The --lossless link I gave was for x265, not x264.

Since all true lossless quality is identical, choice of encoder and preset is really about encoding time, file size, and compatibility.

GMJCZP
15th July 2021, 14:19
Thanks again.

A clarification: when I speak of Simplex264 I refer to Lord Mulder's program, at no time have I said dryly x264, from the first post I have said that I have carried out tests with x265 WITH the SimpleX264 program, that its full name is Simple x264 / x265 Launcher.

Once the clarification is done, is everything said before valid for x265 in its entirety?

benwaggoner
15th July 2021, 16:48
A clarification: when I speak of Simplex264 I refer to Lord Mulder's program, at no time have I said dryly x264, from the first post I have said that I have carried out tests with x265 WITH the SimpleX264 program, that its full name is Simple x264 / x265 Launcher.

Once the clarification is done, is everything said before valid for x265 in its entirety?
Indeed it is.

GMJCZP
15th July 2021, 18:40
Indeed it is.

Thank you very much.

Balling
27th August 2021, 08:52
Nvidia Turing encoder does support lossless preset as well as more modern -tune:v lossless for hevc. Also, AV1 has lossless mode too, maybe (there are tests that show it, but I did not check myself) that one is even better.

Also please note that x264 lossless encoder is better than x265 usually, or at least it was the case not so long ago.

Katie Boundary
29th August 2021, 06:32
For exporting purposes, how many of these codecs are compatible with Premiere, Virtualdub, etc.? How many have convenient installers for Windows?

jpsdr
29th August 2021, 09:49
In that case, my guess is UTVideo may be the best. I think it's integrated on FFMPEG (so maybe it can be opened/work on Linux), there is Mac & Windows version, no issue with Virtualdub, probably no issue with Premiere but not checked personnaly.

poisondeathray
29th August 2021, 14:37
In that case, my guess is UTVideo may be the best. I think it's integrated on FFMPEG (so maybe it can be opened/work on Linux), there is Mac & Windows version, no issue with Virtualdub, probably no issue with Premiere but not checked personnaly.


UT works in Premiere, but YUV versions get converted to RGB. Most YUV lossless codecs get converted to RGB in NLE's

PCU
8th October 2021, 08:38
Friends, found this commercial some how new lossless codec: (pinned, but no one mentioned!)
MagicYUV Lossless Video Codec
https://www.magicyuv.com/

A practical codec you can use Today!
MagicYUV is not just for the “Big Players” using specialized systems and expensive hardware. It is a codec for everyone to be used on everyday desktop computers.

Works out-of-the-box with popular video editing software, through Video For Windows or QuickTime interface.
VideoLAN VLC plugin for cross-platform playback and viewing of MagicYUV encoded video files.
Plugin for Adobe Premiere Pro, Media Encoder and After Effects for direct import and export, supporting 10bit+ color depth (Ultimate Edition only).
Plugin for MAGIX Vegas Pro 17/18 for direct import and export, supporting 10bit+ color depth (Ultimate Edition only).
Windows
Adobe plugins
Vegas Pro plugins
Video For Windows codec (32/64 bit)
QuickTime component
VLC decoder plugin (32/64 bit)
Software Development Kit

macOS
Adobe plugins
QuickTime component
VLC decoder plugin (64 bit)
Software Development Kit

Linux
VLC decoder plugin (32/64 bit)
Software Development Kit

Packed with features
Mathematically lossless
Unlike visually lossless codecs, MagicYUV is mathematically lossless, meaning that the decompressed output is bit-by-bit identical to the original input.

This means there is no generation loss. You can re-compress the same clip over and over as many times as you want without quality degradation.

Compressed formats
MagicYUV offers a variety of compressed formats to choose from with built-in high quality and fast conversion for ease of use.

8-bit:
RGB/RGBA
YUVA 4:4:4:4
YUV 4:4:4
YUV 4:2:2
YUV 4:2:0
YUV 4:0:0 (greyscale)
10-bit:
RGB/RGBA
YUV 4:4:4
YUV 4:2:2
YUV 4:2:0
YUV 4:0:0 (greyscale)
12/14-bit:
RGB/RGBA
Input/output formats
MagicYUV supports a wide array of input/ouput pixel formats for maximum compatibility with applications.

8-bit:
RGB24, RGB32, RGBA
AYUV
YV24, I444
YUY2, YUYV, UYVY, 2vuy, HDYC
YV12, I420, IYUV
Y8, Y800, GREY
and many more…
10-bit+:
r210, R10k, b48r, b64a
v210, P210, I2AL
GBAL, GBFL
and many more…

Ultimate
$24+
Latest release (2.3.0)
All colorspaces
8 bit color depth
10/12/14 bit color depth
Vegas, Adobe plugins

Download Trial:
Windows - macOS - Linux

PCU
8th October 2021, 09:06
Friends, do you think the codec would be good if CorePNG were still being developed?

DJATOM
8th October 2021, 13:49
Friends, found this commercial some how new lossless codec: (pinned, but no one mentioned!)

0.9 alpha

Released: 2014.02.12.
It's quite old already.
I don't have much interest in payware (except I can't live without it), so haven't tried.

PCU
8th October 2021, 15:17
It's quite old already.
I don't have much interest in payware (except I can't live without it), so haven't tried.

It is newer than other codecs and free trial is available. also, it's actually freemium.
WOW, 5909X with 2070!? You have to buy 3090!

DJATOM
8th October 2021, 16:22
Once it will be sold for MSRP. Don't wanna pay 2.5x for it.

PCU
8th October 2021, 20:27
Once it will be sold for MSRP. Don't wanna pay 2.5x for it.

You have to wait until 2023/24!

VoodooFX
8th October 2021, 22:34
Friends, found this commercial some how new lossless codec: (pinned, but no one mentioned!)
MagicYUV Lossless Video Codec
https://www.magicyuv.com/

Not "new", if the key factor for you is speed then it's the best, imo. And it's free (v1.2), I guess that v2 is even more faster.

PCU
9th October 2021, 10:16
Not "new", if the key factor for you is speed then it's the best, imo. And it's free (v1.2), I guess that v2 is even more faster.

100% lossless & best compression is important for me.

PCU
9th October 2021, 10:33
Konstantinos Konstantinides
, Co-authored a book on image, video, and audio compression.
Answered February 18, 2016
Originally Answered: what is the best lossless video compression technique with the best compression ratio?
Digital cinema uses lossless JPEG2000. More recently, H.265 added a lossless mode as well. Acoording to a 2012 paper (http://www.apsipa.org/proceedings_2012/papers/252.pdf ) Motion JPEG 2000 (using wavelets) appears to be slightly better than H.265. JPEG-LS is not that far behind either.

PCU
9th October 2021, 10:35
Bob Hannent
, Playback and delivery architect at a large streaming company
Answered January 22
HuffYUV and Lagarith are probably the best absolutely lossless codecs, you can compare their techniques. Although it's worth pointing out that just the way you transform the colour from RGB to YUV (or other colour formats) is a mathematically lossy process.

With 4K and more affordable SSD storage there has been a rise in the use of RAW-ish formats but they are largely proprietary.

But also most organisations don't want or need totally lossless, more visually lossless and that's why JPEG2000, JPEG-XS/XR and AVC-Ultra are very common formats for interchange in professional circles.

There is a big difference between 2:1 compression which you might get with something like Huffman tables and the 10:1 or better that you can get with accepting the output won't be pixel for pixel identical as the source.

DJATOM
9th October 2021, 12:00
You have to wait until 2023/24!

I'm fine with it. 2070 is enough for now.

PCU
9th October 2021, 12:19
Any active lossless video codec with Adobe plugin support? (excluding MagicYUV & FFV1)

VoodooFX
9th October 2021, 14:07
100% lossless & best compression is important for me.

Then look at x265, because MagicYUV's compression ratio is weak.

PCU
9th October 2021, 17:12
Then look at x265, because MagicYUV's compression ratio is weak.

Is x265 really lossless?

VoodooFX
9th October 2021, 17:45
Is x265 really lossless?
What means "really lossless" (or "not-really lossless")?

PCU
10th October 2021, 09:19
What means "really lossless" (or "not-really lossless")?

I heard that it is not 100% lossless and when converting the image quality is lost.

StainlessS
10th October 2021, 10:40
Mathematically lossless

Unlike visually lossless codecs, MagicYUV is mathematically lossless, meaning that the decompressed output is bit-by-bit identical to the original input.

This means there is no generation loss. You can re-compress the same clip over and over as many times as you want without quality degradation.

Above from previously link to its home site.

If using eg YV12 loaded into VirtualDub2 Full Processing mode,
and saving as compressed YUV then will go through conversion to RGB and then to YUV and then compressed.
So, there would be losses in colorspace conversions, but the compression itself is lossless.
[Full Processing, mode converts to RGB for Vdub processing/filtering]

Fast Recompress mode, will enter into negotiation between VDub and MagicYUV and come up with a strategy to avoid colorspace conversion, if possible.

Above how it used to be, there is new VD2 Normal Recompress, not sure how that is different.

VoodooFX
10th October 2021, 11:58
I heard that it is not 100% lossless and when converting the image quality is lost.
If you don't compress as lossless then it's not lossless, if you compress as lossless then it's lossless.

PCU
10th October 2021, 12:04
If you don't compress as lossless then it's not lossless, if you compress as lossless then it's lossless.

What settings should I use?

PCU
10th October 2021, 12:06
Above from previously link to its home site.

If using eg YV12 loaded into VirtualDub2 Full Processing mode,
and saving as compressed YUV then will go through conversion to RGB and then to YUV and then compressed.
So, there would be losses in colorspace conversions, but the compression itself is lossless.
[Full Processing, mode converts to RGB for Vdub processing/filtering]

Fast Recompress mode, will enter into negotiation between VDub and MagicYUV and come up with a strategy to avoid colorspace conversion, if possible.

Above how it used to be, there is new VD2 Normal Recompress, not sure how that is different.

What about AME (Adobe Media Encoder)? I always use it as my media converter with lots of plugins.

PCU
10th October 2021, 12:25
https://qph.fs.quoracdn.net/main-qimg-a6155014e55d6c047f1c54aceb4cab69

StainlessS
10th October 2021, 12:29
What about AME (Adobe Media Encoder)?
Sorry, no idea, I dont use it.
Also, I rarely use MagicYUV and only have the old free one that runs on XP.
[I usually use Ut_Video, and again only the old XP compatible one]

PCU
10th October 2021, 13:02
Sorry, no idea, I dont use it.
Also, I rarely use MagicYUV and only have the old free one that runs on XP.
[I usually use Ut_Video, and again only the old XP compatible one]

What lossless format compresses most of all, still YULS?

VoodooFX
10th October 2021, 14:38
What settings should I use?
You should read answers on your thread.

Friends, found this commercial some how new lossless codec: (pinned, but no one mentioned!)
MagicYUV
Actually it was mentioned twice!

PCU
10th October 2021, 14:58
You should read answers on your thread.


Actually it was mentioned twice!

Yes, sorry, I'm blind :D, but It was about ~3 months ago!

PCU
10th October 2021, 15:30
Don't know about advanced settings of x265
https://i.ibb.co/QDv4RjN/1.png
https://i.ibb.co/Jj4fygP/2.png

Just look at the scroll bar, lots of advanced settings!

benwaggoner
13th October 2021, 00:17
Don't know about advanced settings of x265

Just look at the scroll bar, lots of advanced settings!
If you enjoy those, you'll love the x265 thread (https://forum.doom9.org/showthread.php?t=168814) and the official x265 documentation (https://x265.readthedocs.io/en/master/cli.html).

PCU
13th October 2021, 08:17
If you enjoy those, you'll love the x265 thread (https://forum.doom9.org/showthread.php?t=168814) and the official x265 documentation (https://x265.readthedocs.io/en/master/cli.html).

Thank you. please add thanks button to every reply if it's possible.

PCU
10th January 2022, 13:21
Guys, do you think this claim is true?:
x264 cannot actually achieve lossless. It's lossless setting is close but ProRes422 is generally a little better quality, faster rendering, and smaller. MagicYUV is another possible option.

rwill
10th January 2022, 13:34
Guys, do you think this claim is true?
x264 cannot actually achieve lossless. It's lossless setting is close but ProRes422 is generally a little better quality, faster rendering, and smaller. MagicYUV is another possible option.

Please stop. My head hurts.

Really how can something has a little better quality than lossless ?

FranceBB
10th January 2022, 13:42
Guys, do you think this claim is true?
x264 cannot actually achieve lossless. It's lossless setting is close but ProRes422 is generally a little better quality, faster rendering, and smaller. MagicYUV is another possible option.

I don't think is true, but you can try it yourself.

Take a source, use x264 lossless to encode the file, then use SSIM and PSNR to compare it with the source.
If they return infinite, so perfect score, then it's really lossless, if they don't, then it's not.
I would be very surprised if the result came out anything other than infinity, so lossless.
ProRes is lossy and uses the DCT, so I expect the result from SSIM and PSNR to be a real number, lower in value.

PCU
10th January 2022, 13:58
God willing, how literate are the users of pro NLEs. I could not tell him how literate he was!http://www.emoticonr.com/design/yahoo/big-grin.gifhttp://www.emoticonr.com/design/yahoo/rolling-on-the-floor-laughing.gifhttp://www.emoticonr.com/design/yahoo/laughing.gif

PCU
13th March 2022, 10:29
What do you think about this opinion:

https://www.quora.com/What-is-the-most-size-efficient-lossless-video-compression-codec

Most codecs are not truly lossless, since mathematically lossless compression usually doesn’t give significant reduction in size and bit rate, and thus lossless compression is pretty much useless for video.

Now, you can ask about “visually lossless” compression, which means that the input and output are not bitwise identical, but that the differences are not visible to a human observer with some specified visual acuity under some specified conditions.

Of the current lossy codecs, H.265 and VP9 are probably the best for quality at a fixed bit rate.

If possible, you should compare codecs using your own typical content, and viewing under your own typical viewing conditions.

If you read the literature of codecs, they are always comparing their new codec against some previous best result. However, be wary of what measure they use for comparisons. Until recently, it was common to use measures like PSNR or SSIM to rate codecs, and these measures do not correlate well with human quality judgements. The VMAF video quality measure created by Netflix is designed to be better, but you should be aware of what it was designed to pay attention to. Also be aware that there are 3 different sets of “calibration” data for VMAF, depending on whether the viewer is assumed to be watching a UHD monitor at 1.5 times picture height, a HD monitor from 3 times picture height, or a mobile device from significantly further than 3 times picture height.

kolak
13th March 2022, 11:05
Answer states established facts. Typical 'scholarly' answer :)
You have mathematically lossless codecs (modes) and visually lossless. h264/5 can be both, other codecs can be just on of those.

rwill
13th March 2022, 14:50
Well if someone does not want to dive into codec details and does not want to research his use case I would recommend him to use 7zip for his lossless needs.

PCU
13th March 2022, 16:53
Answer states established facts. Typical 'scholarly' answer :)
You have mathematically lossless codecs (modes) and visually lossless. h264/5 can be both, other codecs can be just on of those.

Besides being 100% lossless, I'm looking for the highest compression codec.

PCU
13th March 2022, 16:56
Can we call it the new video codec benchmark? If yes, how to use it:
https://github.com/Netflix/vmaf

Sharc
14th March 2022, 11:09
The "best" codec for archiving is the one which will still be available for decoding the archived files in 100++ years :D

kolak
14th March 2022, 11:48
Exactly.
Also with lossless you don't gain much between best and worse codec, so chase for the best losses compression is about pointless. Some work better for anime, others for noisy etc. but on average all decent ones will be very similar:
https://qph.fs.quoracdn.net/main-qimg-87257e1c9eef715c3f19b1dfa02df830-pjlq
Use what works for you from the workflow point.
All those metrics are pointless for mathematically lossless codecs. They are lossless, so all will have same value (1 or whatever means "same as source) :)
If you familiar with ffmpeg use ffv1, which should hold for years as many national archives are now using it. It's efficient and not terribly slow. x264 is also viable option (x265 is slower for no real gain).

PCU
14th March 2022, 12:11
Thanks, but:
There are multiple criteria to take into account: encoding speed, decoding speed, bit depth, codec features, temporal compression, sub-resolution decoding. And quality-wise there are multiple different metrics (sign to noise ratio, human vision, generation loss, etc.). So I'd say it's a very hard topic to discuss...

Goal: best compression for HDR:

Current codecs:

MagicYUV
FFV1
x265
AV1
VC-2
JPEG XS lossless
Ut Video Codec Suite
CorePNG
Lagarith


So, what do you recommend for example: recoding video games with HDR, at least 60 FPS, 4K?

kolak
14th March 2022, 14:48
Your workflow/specific case dictates your choice.
UHD 60fps requires very fast codec.
Most codecs from your list won't work due to performance.
As I said- first look what apps you can use and what options they give you. Encoding 4K games at 60 fps isn't that trivial.
Why do you need lossless encoding for games? Is it not overkill?

All mentioned quality metrics are meaningless for lossless encoding as there is no difference to the source, so nothing to measure (nor any generation loss).

PCU
14th March 2022, 15:41
I edit the recorded videos of the game and sometimes I have to convert them lossless.
I use Premiere Pro and Media Encoder and talk to the plugin developer for Premiere Pro to add which lossless codec to PP and AME, but it's hard work which codec is better.
So, I think only these 3 codecs are what I really need to make a decision about, right?:
MagicYUV
FFV1
x265

kolak
14th March 2022, 16:35
If you really need lossless file ( I still don’t think you do) and you edit in Premiere then MagicYUV will be your best bet ( once you have plug-in which lets Premiere to import it at 8bit+).
Ffv1- may be hard to get real-time encoding and Premiere doesn’t support it if I’m correct. x265 is another option, but of course through GPU encoding.

So your long list and loads of thinking got simplified to basically a single choice :)

PCU
14th March 2022, 18:50
If you really need lossless file ( I still don’t think you do) and you edit in Premiere then MagicYUV will be your best bet ( once you have plug-in which lets Premiere to import it at 8bit+).
Ffv1- may be hard to get real-time encoding and Premiere doesn’t support it if I’m correct. x265 is another option, but of course through GPU encoding.

So your long list and loads of thinking got simplified to basically a single choice :)

FFV1 is supported by Voukoder, x265 does not support HW acceleration and I'll have to pay for MYUV for full version!

But I think it all ends in MYUV!

Zarxrax
14th March 2022, 20:44
You can use DNxHR or Prores. They are perceptually lossless and probably faster than even Magic YUV. Can encode in FFMPEG and at least one of them should be supported in premiere. Nothing to buy.

kolak
14th March 2022, 21:37
FFV1 is supported by Voukoder, x265 does not support HW acceleration and I'll have to pay for MYUV for full version!

But I think it all ends in MYUV!

Try encoding ffv1 UHD 60p in realtime...

kolak
14th March 2022, 21:41
You can use DNxHR or Prores. They are perceptually lossless and probably faster than even Magic YUV. Can encode in FFMPEG and at least one of them should be supported in premiere. Nothing to buy.

They are not necessarily faster than MagicYUV, but you need good disk for lossless.

Balling
20th March 2022, 00:15
Guys, do you think this claim is true?:
x264 cannot actually achieve lossless. It's lossless setting is close but ProRes422 is generally a little better quality, faster rendering, and smaller. MagicYUV is another possible option.

It cannot achieve lossless in high10 profile. But there is high444 that does give you lossless even in 10 bit. But i think av1 lossless should be better, in aomenc.

FranceBB
21st March 2022, 10:42
They are not necessarily faster than MagicYUV, but you need good disk for lossless.

Also, if you're gonna encode in prores, you should use the -vendor apl0 flag otherwise some players might bitch about it not being an Apple Compliant encoded file.

By the way, as Kolak said, they're not necessarily faster than other codecs AND they're NOT lossless, so... are you really sure you wanna go that route?
And by the way, if you must choose between DNxHR and Apple ProRes, go the DNxHR route, so that at least you're gonna pick the "less evil" between the two given that Apple is artificially trying to block FFMpeg encoded files from playing on their players / devices while AVID is not.

kolak
21st March 2022, 20:39
Ffmpeg ProRes is rather slow.
Apple code is quite fast, but best is M1 hardware chip inside new Macs. This can do way pass 1000fps when decoding+encoding (simultaneously) HD ProRes, so very impressive.

PatchWorKs
23rd July 2022, 16:39
Sorry to revive this 3ad, but I need your help to optimize FFMPEG encoding parameters.

I need to losslessy encode a set of 14500+ 32bits 2K BMPs (~137Gb) in order to build the final compositing and (re)encoding.

I've tested the following cmdline, but my NLE - Vegas Pro 19 - handle it bad (wrong colors, unplayable):

ffmpeg -hwaccel auto -framerate 25 -i SEQ1_%06d.bmp -vcodec libx265 -x265-params lossless=1 SEQ1_x265.mp4

...any suggestion ?

Thanks in advance to anyone that will help.

FranceBB
23rd July 2022, 19:44
I assume that when you say bmp 24bit you mean RGB24.
What's the input colormatrix, primaries and transfer?
If you shot in BT709 SDR Full PC Range RGB24 8bit, try this:

ffmpeg.exe -framerate 25 -i "SEQ1_%06d.bmp" -pix_fmt yuv444p -vcodec libx265 -color_primaries 1 -color_trc 1 -colorspace 1 -x265-params lossless=1 -an -y "SEQ1_x265.mp4"

Otherwise just use the great FFAStrans (https://forum.doom9.org/showthread.php?t=176655) with the Image Sequence Monitor and output to a sane mezzanine file for NLE like DNX or Apple ProRes and the filter_builder will take care of everything for you automatically. ;)

kolak
24th July 2022, 16:21
Sorry to revive this 3ad, but I need your help to optimize FFMPEG encoding parameters.

I need to losslessy encode a set of 14500+ 32bits 2K BMPs (~137Gb) in order to build the final compositing and (re)encoding.

I've tested the following cmdline, but my NLE - Vegas Pro 19 - handle it bad (wrong colors, unplayable):

ffmpeg -hwaccel auto -framerate 25 -i SEQ1_%06d.bmp -vcodec libx265 -x265-params lossless=1 SEQ1_x265.mp4

...any suggestion ?

Thanks in advance to anyone that will help.

Sounds like Vegas can’t decode lossless h265.
Are you sure it can. What about playback in player which you know it can?
I would use something like MagicYUV etc of instead of h265.

PatchWorKs
25th July 2022, 10:56
I assume that when you say bmp 24bit you mean RGB24.
Yes, sorry, you're right.


What's the input colormatrix, primaries and transfer?
If you shot in BT709 SDR Full PC Range RGB24 8bit, try this:

ffmpeg.exe -framerate 25 -i "SEQ1_%06d.bmp" -pix_fmt yuv444p -vcodec libx265 -color_primaries 1 -color_trc 1 -colorspace 1 -x265-params lossless=1 -an -y "SEQ1_x265.mp4"
Works like a charm, thanks !

Just a curiosity: this command line produces smaller files than the other... it's caused by the wrong colorspace ?

Thanks for your great support !

PatchWorKs
25th July 2022, 11:03
Sounds like Vegas can’t decode lossless h265.
Are you sure it can. What about playback in player which you know it can?
I would use something like MagicYUV etc of instead of h265.
Now works, was the wrong commandline.

I evaluated MagicYUV but I still don't understand how use it from commandline...

poisondeathray
25th July 2022, 15:19
I need to losslessy encode a set of 14500+ 32bits 2K BMPs (~137Gb) in order to build the final compositing and (re)encoding.


Why don't you just import the image sequence directly in vegas?

-pix_fmt yuv444p (8bit YUV444) is not a lossless transform from 8bit RGB24

FranceBB
25th July 2022, 22:12
Works like a charm, thanks !


Perfect. I'm glad to hear that. :)


Just a curiosity: this command line produces smaller files than the other... it's caused by the wrong colorspace ?


YUV by definition is easier to compress than RGB.

I know that you're Italian, so you can read a document I wrote about those things years ago (in Italian): link (https://view.publitas.com/p222-8308/francesco-bucciantini-utilizzo-delle-trasformate-nella-codifica-delle-immagini-fisse-in-movimento-ed-audio/page/1)

Go to page 56-57 and you'll see the whole YCbCr YUV / RGB thing. ;)

Balling
9th August 2022, 15:09
I assume that when you say bmp 24bit you mean RGB24.

bgr. BMP is always using BGR.

Balling
9th August 2022, 15:31
Sorry to revive this 3ad, but I need your help to optimize FFMPEG encoding parameters.

I need to losslessy encode a set of 14500+ 32bits 2K BMPs (~137Gb) in order to build the final compositing and (re)encoding.

I've tested the following cmdline, but my NLE - Vegas Pro 19 - handle it bad (wrong colors, unplayable):

ffmpeg -hwaccel auto -framerate 25 -i SEQ1_%06d.bmp -vcodec libx265 -x265-params lossless=1 SEQ1_x265.mp4

...any suggestion ?

Thanks in advance to anyone that will help.


Use true lossless (if you have nvidia gpu see next):

ffmpeg.exe -framerate 25 -i "SEQ1_%06d.bmp" -color_primaries 1 -color_trc 1 -c:v libx264rgb -preset veryslow -color_primaries 1 -color_trc 1 -qp 0 "SEQ1_x265.mp4"

Or use normal lossless Nvidia coder.

ffmpeg -framerate 25 -i "SEQ1_%06d.bmp" -color_primaries 1 -color_trc 1 -c:v hevc_nvenc -preset p7 -tune lossless -pix_fmt gbrp output.mp4

Use normal ffmpeg from here https://github.com/BtbN/FFmpeg-Builds/releases/download/latest/ffmpeg-master-latest-win64-gpl-shared.zip or the command for nvidia will not work, since rgb (gbrp, anyway) was added recently. Also, RGB does not technically support 420 (except in JPEG), so requires 444 chroma, which is supported since Turing on HEVC and AVC (hevc_nvenc and h264_nvenc).

tormento
10th August 2022, 11:43
Please notice that DGDecNV now supports 4:4:4 chroma. With HW accelerated HEVC lossless, it's a perfect match to use with intermediate files.

Balling
10th August 2022, 17:04
Please notice that DGDecNV now supports 4:4:4 chroma. With HW accelerated HEVC lossless, it's a perfect match to use with intermediate files.

This is not chroma, this is rgb (using gbrp).