Convert Hald CLUT to 3D LUT

Hald CLUT

The Shotcut 3D LUT filter only reads certain, usually text-based LUT formats (3dl, cube). However, many tools also offer a Hald CLUT that use a (lossless) image file. There is a python script that one can use to convert these images to a cube file: https://github.com/mikeboers/LUT-Convert

Here is a Google Drive folder of a bunch of G’MIC Hald CLUTs that have already been converted:
https://drive.google.com/drive/folders/1cBaI31TaZgj6Z7abReTEHIJPVtLqY4Dg

Here is another source: http://www.digicrea.be/picturefx/

1 Like

Is there a path to HaldCLUT support in shotcut? Or G’MIC support?

Your first question is answered in the first post.

Maybe I structured my question incorrectly. I assume you mean at the moment there is no support for HaldCLUT in shotcut. I am aware of that.

My question is if there are any plans to support it in the future? Maybe the answer to that question is no too.

Indeed, I understood your post as a question for current and not upcoming support.

Another resource for converting Hald CLUTs to 3D Cube
LUTs is here: https://filterhunt.com/

Login with facebook …? Not too sure if I like this website already

OK I have looked into this a bit further.

LUT-Convert doesn’t seem to support black and white images (pngs). I have forked and edited it to improve that.

Shotcut doesn’t accept some of the *.cube files I generate. I suspect that they are too big. The files above are give as 8x8x8. Which results in a cube file that is about 7MB whereas the ones I am trying to covert are 12x12x12 and the cube file comes out at nearly 80MB. When I try an apply the LUT it does nothing.

Is there a limitation on avfilter.lut3d on size? I may also have messed something up.

I am trying to write a filter to handle all this in the background. Is there a way in shotcut to open and read the contents of an image file? Here it would be as simple to open the image file and write out the cube file that could be an input the the remainder of the filter that is there all ready. It is a bit heavy handed but it would be a start.

Also when trying to write a filter, it there a way to print out messages to some type of console to debug what is happening?

Your facebook username/password combination is not passed on to the site.Like many sites it uses the “OAuth” mechanism to validate you. There is a good explanation at the webpage below that explains how it works.

FFmpeg lut3d filter supports up to 128x128x128 in latest version. But perhaps you use older version. Try with ffmpeg alone, if lut3d file does still not work, please provide such file(s).

I am not too sure how to try lut3d with ffmpeg.

However I have uploaded some examples that are not working.

Color
https://github.com/douglaskastle/LUT-Convert/blob/master/luts/BleachBypass1.cube?raw=true

Black and White
https://github.com/douglaskastle/LUT-Convert/blob/master/luts/agfa_apx_100.cube?raw=true

They have a LUT_3D_SIZE 144 I have manually edited these files down to LUT_3D_SIZE 64 and reduced the number of entries to match. They work/have a effect (the effect is crap because it is not scaled correctly, but you can see it have an effect on the image)

Latest ffmpeg lu3d file works with max 128x128x128. And using it is simple.

OK got latest ffmpeg on windows and figured out how to apply the lut3d.

Here is the syntax in case any one else is looking for it:

ffmpeg.exe -i small.mp4 -vf lut3d="luts/BleachBypass1.cube" text.mp4

It fails!

[Parsed_lut3d_0 @ 000001831baee640] Too large or invalid 3D LUT size
[AVFilterGraph @ 000001831b822740] Error initializing filter 'lut3d' with args 'luts/BleachBypass1.cube'
Error reinitializing filters!
Failed to inject frame into filter network: Invalid argument
Error while processing the decoded data for stream #0:0

As a backup I generated a 144 size cube file using G’MIC, and the resultant lut3d file also causes ffmpeg to bomb out. Here is how to generate a 144 cube file using G’MIC, this is for the 60s clut build into the tool:

gmic.exe clut 60s,144 output_cube luts/60sx144.cube

Yes, I’m aware of current limitation, and I posted patch to fix this on ffmpeg-devel mailing list. How big size can go up? is 144 max or it can go to 256?

According to the specification the maximum is 256. See:

https://wwwimages2.adobe.com/content/dam/acom/en/products/speedgrade/cc/pdfs/cube-lut-specification-1.0.pdf

Sorry, are you saying that you can see this problem now?

If it fails at 144 does it matter what happens at 256?

Yes, I see problem, and I already posted solution for it in form of source code patch. Anyone can review such patch on ffmpeg-devel mailing list to speed up its adoption to master FFmpeg branch. Am asking for 256 so to not have such similar problems like this one in near future.

I am away from my computer for a few days so i can’t generate one my self at the moment. However if you have access to G’MIC your should be able to generate it yourself

gmic.exe clut 60s,256 output_cube luts/60sx256.cube