[FFmpeg-user] [Cin] FranceBB's LUT collection

Mark Filipak markfilipak.imdb at gmail.com
Sun May 18 04:35:56 EEST 2025


For people who are wondering what this is all about, I have a summary at the bottom.

On 17/05/2025 16.46, Andrew Randrianasulu wrote:
> On Sun, May 18, 2025 at 2:37 AM Mark Filipak <markfilipak.imdb at gmail.com> wrote:
>> ...
>> I tried a few 'cubes'. I was unsure which 'cubes' to use based solely on their names -- for example,
>> what does 'linear' mean in this context
> 
> As far as I understand "linear" here means linear light, without any
> gamma curve applied, mostly for  further processing?

For example, HLG_BT2020_to_Linear_BT709.cube. What does "Linear_BT709" mean? Linear... how? BT709 is 
not linear, so what's Linear_BT709?

To sum-up to this point...

Let's call the next lines "tonemap-based".

set _TWEAK_=eq=contrast=1.28:brightness=0.0725
ffmpeg^
...
  -filter_complex^
  "[0:v]scale=w=iw/2:h=ih/2^
,zscale=transfer=linear:npl=100,format=gbrpf32le^
,tonemap=tonemap=hable:desat=0^
,zscale=primaries=bt709:transfer=bt709:matrix=bt709:range=tv^
,%_TWEAK_%^
,format=yuv420p[v]"^
  -map "[v]"^
...

as you see, that's not much tweaking.

Now, let's call the next lines "LUT-based".

ffmpeg^
...
  -filter_complex^
  "[0:v]scale=w=iw/2:h=ih/2^
,lut3d=file='BT2100_HDR_PQ_to_BT2020_SDR.cube'^
,lut3d=file='BT2020_to_BT709.cube'
,format=yuv420p[v]"^
  -map "[v]"^
  ...

In contrast to tonemap-based, LUT-based conversions needed a lot more tweaking -- not shown because 
I didn't actually waste my time tweaking what obviously required much more tweaking.

But LUT-based conversions are not supposed to need tweaking!

My understanding is that your friends in France took various Hybrid Log-Gamma (HLG) curves for 
BT2100, BT2020, BT709, etc. and made LUTs of them for use doing conversions.
My understanding is that the LUTs are formatted to work with FFmpeg's 'lut3d' filter.
Something is wrong with my understandings, methinks.

What do you think? Or do I need to go to France? :-)


For people who are wondering what this is all about, I have a summary: HLG acts like ordinary gamma 
(almost 1:1 source-to-target transfer) for low-to-mid input luminance: 0.0..0.5, but acts like a 
logarithm (like compression) for mid-to-high input luminance: 0.5..1.0. Basically, it smoothly and 
progressively reduces the HDR values that are 'tending' to go whiter than SDR white, HDR values that 
blow out skies and sun-glints when in SDR, without losing HDR's deep blacks very much and without 
SDR's gray banding. The alternative to all this curve stuff is taking the HDR values that don't fit 
into SDR, and just clipping-to-white, blowing out skies and glints and highlights, etc.

Of course, if you don't have an HDL source, then you're stuck with ordinary SDL and there's nothing 
you can do about it.

As a bonus that's unrelated to color tones, HDR means UHD resolution (i.e. 2160x2040 or more), so 
you'll be able to transcode to HD (i.e. 1920x1080) and not only _not_ lose resolution, but actually 
get better resolution (better textures, cleaner edges) than most HD Blu-rays have.

I have taken a 55 GiB, 2 hour 36 minute UHD movie -- HEVC encoded -- and made a 3.5 GiB HD copy -- 
AVC encoded -- that looks better than the native HD Blu-ray of the same movie, better in every way.




More information about the ffmpeg-user mailing list