Using a LUT (.cube) via workflow

Questions and answers on how to get the most out of FFAStrans
User avatar
FranceBB
Posts: 264
Joined: Sat Jun 25, 2016 3:43 pm
Contact:

Using a LUT (.cube) via workflow

Post by FranceBB »

Hi,
I'm getting some Slog3 and C-Log videos and I'd like to apply a LUT to bring them to the standard linear curve with BT709.
I made a custom Avisynth Script like so:

Code: Select all

# Variables:
#
# m_clip		= The last returned AviSynth media
#
# Do NOT change any of the following variables!!!
# _ffas_video 	= <original video>
# _ffas_audio	= <original audio>
# _ffas_height	= <source height>
# _ffas_width	= <source width>
# _m_clip_a_channels = <total channels>
# _ffas_work_fdr	= Working folder for the workflow
#
LoadPlugin("C:\encoder\encoder\Processors\avs_plugins\LUTs\vscube.dll")


c=Converttoyv24(m_clip)
hbd=ConvertBits(c, bits=16)
plrgb=ConvertToPlanarRGB(hbd)
m_clip=Cube(plrgb, "C:\encoder\encoder\Processors\avs_plugins\LUTs\Slog3_Avisynth.cube")

# The following MUST be the last line of your script
Return m_clip

Then I go back to my usual workflow which includes Clipping Luma and Chroma to Limited TV Range, however I can't manage to make it work.
Since ffmpeg is actually able to use a LUT as well, I think it would be useful to create a Node called "LUT" that goes through ffmpeg and simply adds the "-vf lut3d=" command and then pipes the output to whatever.

Image


You can find the Cube filter for avisynth here, instead: forum.doom9.org/showthread.php?t=175552

By making LUTs available, it would be useful for HLG / PQ as well.

Thank you in advance,
Frank.
Last edited by FranceBB on Wed May 08, 2019 7:08 am, edited 2 times in total.
emcodem
Posts: 1811
Joined: Wed Sep 19, 2018 8:11 am

Re: Using a LUT (.cube) via workflow

Post by emcodem »

Hey Frank,

this sounds more like it fits to the feature request section as you already know how to apply the lut using ffmpeg. In tje meantime, this might help;
viewtopic.php?f=5&t=849#p3641

cheers, emcodem
emcodem, wrapping since 2009 you got the rhyme?
User avatar
FranceBB
Posts: 264
Joined: Sat Jun 25, 2016 3:43 pm
Contact:

Re: Using a LUT (.cube) via workflow

Post by FranceBB »

For the records, I managed to get it to work by compiling vscube myself and it works perfectly fine with 16bit precision calculations.
As to the LUTs, I created them and I shared them here on Doom9: https://forum.doom9.org/showthread.php?p=1873351

- PQ to BT709 SDR
- HLG to BT709 SDR
- PQ to HDR HLG
- Slog3 to BT709 SDR
- Clog3 to BT709 SDR
- Clog3 to PQ
- Clog3 to HLG
- BT709 SDR to PQ
- BT709 SDR to HLG

Feel free to download and use them. ;)
momocampo
Posts: 595
Joined: Thu Jun 08, 2017 12:36 pm
Location: France-Paris

Re: Using a LUT (.cube) via workflow

Post by momocampo »

Hello Franck,

Thanks a lot for this! It will be useful for sure.
I wonder if you work on Sony Slog 2? I must admit it will be useful for me :)
Thanks again.
Cheers.

Benjamin
User avatar
FranceBB
Posts: 264
Joined: Sat Jun 25, 2016 3:43 pm
Contact:

Re: Using a LUT (.cube) via workflow

Post by FranceBB »

momocampo wrote: Wed May 08, 2019 9:06 am Hello Franck,

Thanks a lot for this! It will be useful for sure.
I wonder if you work on Sony Slog 2? I must admit it will be useful for me :)
Thanks again.
Cheers.

Benjamin
I don't use Slog2 anymore, but I do have some old contents shot using that curve.
I guess I can try to make a new LUT for it as well when I have time.
You need from Slog2 to BT709 SDR, right?
momocampo
Posts: 595
Joined: Thu Jun 08, 2017 12:36 pm
Location: France-Paris

Re: Using a LUT (.cube) via workflow

Post by momocampo »

Hello,
Very kind from you.
And yes, it's Slog 2 to rec 709.
Thanks ;)

Benjamin
User avatar
FranceBB
Posts: 264
Joined: Sat Jun 25, 2016 3:43 pm
Contact:

Re: Using a LUT (.cube) via workflow

Post by FranceBB »

momocampo wrote: Wed May 08, 2019 6:32 pm Hello,
Very kind from you.
And yes, it's Slog 2 to rec 709.
Thanks ;)

Benjamin
It's almost ready.
https://forum.doom9.org/showthread.php? ... ost1874078
Next week I'm gonna make the final tweaks and I'm gonna upload it.
momocampo
Posts: 595
Joined: Thu Jun 08, 2017 12:36 pm
Location: France-Paris

Re: Using a LUT (.cube) via workflow

Post by momocampo »

Hi,
Great!! It's really kind to create this lut for me, I appreciate.
Thanks you very much.
Cheers.

Benjamin
User avatar
FranceBB
Posts: 264
Joined: Sat Jun 25, 2016 3:43 pm
Contact:

Re: Using a LUT (.cube) via workflow

Post by FranceBB »

LUT uploaded. Let me know if it works for you. ;)
momocampo
Posts: 595
Joined: Thu Jun 08, 2017 12:36 pm
Location: France-Paris

Re: Using a LUT (.cube) via workflow

Post by momocampo »

Hello FranceBB,
Well I took it , thank you.
I must find how to test it with my slog2.
Can you help me to tell me where I can find avs plug in ? (vscube.dll into your avisynth script)
Thanks again.

Cheers.
Benjamin
Post Reply