NVEnc icon indicating copy to clipboard operation
NVEnc copied to clipboard

LUT 3D support

Open csl778 opened this issue 3 years ago • 11 comments

Hi,

In Filtering is it possible to please provide ffmpeg or direct support for LUT 3D .cube rather than via VapourSynth ?

11.136 lut3d

Apply a 3D LUT to an input video.

The filter accepts the following options:

file

Set the 3D LUT file name.

Currently supported formats:

‘3dl’

    AfterEffects 
‘cube’

    Iridas 
‘dat’

    DaVinci 
‘m3d’

    Pandora 
‘csp’

    cineSpace 

interp

Select interpolation mode.

Available values are:

‘nearest’

    Use values from the nearest defined point. 
‘trilinear’

    Interpolate values using the 8 points defining a cube. 
‘tetrahedral’

    Interpolate values using a tetrahedron. 
‘pyramid’

    Interpolate values using a pyramid. 
‘prism’

    Interpolate values using a prism. 

https://ffmpeg.org/ffmpeg-filters.html#lut3d-1

Thank you.

csl778 avatar Feb 07 '22 10:02 csl778

It is difficult to use ffmpeg lut3d filter from NVEncC.

I think I might try to implement the algorithm as a new filter for NVEncC, but will need some time.

rigaya avatar Feb 07 '22 12:02 rigaya

Yes, direct support for LUT 3D as a new filter would be great!

I would like to use LUT 3D .cube in your excellent NVEncC for color grading and for advanced HDR to SDR conversion in 4K video.

Many thanks rigaya.

csl778 avatar Feb 07 '22 14:02 csl778

I have updated to NVEnc 5.43, adding new option "lut3d" to --vpp-colorspace.

Could be used like below. It currently supports ".cube" file only as input, but I may add support for others if needed.

--vpp-colorspace lut3d="example.cube",lut3d_interp=trilinear

interp options is limited to nearest, trilinear and tetrahedral, but I think it shall be enough.

Please have a try, and please let me know if you have any issues.

rigaya avatar Feb 14 '22 12:02 rigaya

Would be nice if you could also share Win 64bit binaries for NVEnc 5.43. :) Thanks!

Selur avatar Feb 15 '22 08:02 Selur

Thanks for letting me know the binaries were not there. I have uploaded them now.

rigaya avatar Feb 15 '22 12:02 rigaya

Thanks!

Selur avatar Feb 15 '22 12:02 Selur

Many thanks rigaya for adding the lut3d support.

The lut3d option is working well in NVEnc 5.43.

Maybe in future you could add interp options Pyramid and Prism but it's no rush. One day if you have time.

Thanks again, and Kind regards.

csl778 avatar Feb 16 '22 12:02 csl778

Thank you for confirming, nice to hear it works fine.

Yes, I might try adding pyramid and prism interp options in the future release.

rigaya avatar Feb 16 '22 12:02 rigaya

I got following "PPS....." error for a 10bit HEVC bt2020 input file when using your excellent lut3d option. How can I handle this without error?

NVEncC64.exe --avhw --codec hevc -i test.MOV --vpp-colorspace lut3d="OMSYSTEM_OM-Log400_BT.2020_to_WDR_BT.709_v1.0.cube",lut3d_interp=trilinear --output-res 1920x-2 --audio-codec aac --audio-bitrate 128 --bref-mode each --preset quality -o test.mp4


test.mp4

[mov,mp4,m4a,3gp,3g2,mj2 @ 000001c9a63d8fc0] Referenced QT chapter track not found [hevc @ 000001c9b6bb50c0] PPS id out of range: 1 [hevc @ 000001c9b6bb50c0] PPS id out of range: 1 [hevc @ 000001c9b6bb50c0] PPS id out of range: 2 [hevc @ 000001c9b6bb50c0] PPS id out of range: 1 [hevc @ 000001c9b6bb50c0] PPS id out of range: 1 [hevc @ 000001c9b6bb50c0] PPS id out of range: 2 [hevc @ 000001c9b6bb50c0] PPS id out of range: 1 [hevc @ 000001c9b6bb50c0] PPS id out of range: 1 [hevc @ 000001c9b6bb50c0] PPS id out of range: 2 [hevc @ 000001c9b6bb50c0] PPS id out of range: 1 [hevc @ 000001c9b6bb50c0] PPS id out of range: 1 [hevc @ 000001c9b6bb50c0] PPS id out of range: 2 [hevc @ 000001c9b6bb50c0] PPS id out of range: 1 [hevc @ 000001c9b6bb50c0] PPS id out of range: 1 [hevc @ 000001c9b6bb50c0] PPS id out of range: 2 [hevc @ 000001c9b6bb50c0] PPS id out of range: 1 [hevc @ 000001c9b6bb50c0] PPS id out of range: 1 [hevc @ 000001c9b6bb50c0] PPS id out of range: 2 [hevc @ 000001c9b6bb50c0] PPS id out of range: 1 [hevc @ 000001c9b6bb50c0] PPS id out of range: 1 [hevc @ 000001c9b6bb50c0] PPS id out of range: 2 [hevc @ 000001c9b6bb50c0] PPS id out of range: 1 [hevc @ 000001c9b6bb50c0] PPS id out of range: 1 [hevc @ 000001c9b6bb50c0] PPS id out of range: 2 [hevc @ 000001c9b6bb50c0] PPS id out of range: 1 [hevc @ 000001c9b6bb50c0] PPS id out of range: 1 [hevc @ 000001c9b6bb50c0] PPS id out of range: 2 [hevc @ 000001c9b6bb50c0] PPS id out of range: 1 [hevc @ 000001c9b6bb50c0] PPS id out of range: 1 [hevc @ 000001c9b6bb50c0] PPS id out of range: 1 [hevc @ 000001c9b6bb50c0] PPS id out of range: 1 [hevc @ 000001c9b6bb50c0] PPS id out of range: 2 [hevc @ 000001c9b6bb50c0] PPS id out of range: 1 [hevc @ 000001c9b6bb50c0] PPS id out of range: 1 [hevc @ 000001c9b6bb50c0] PPS id out of range: 2 [hevc @ 000001c9b6bb50c0] PPS id out of range: 1 [hevc @ 000001c9b6bb50c0] PPS id out of range: 1 [hevc @ 000001c9b6bb50c0] PPS id out of range: 2 [hevc @ 000001c9b6bb50c0] PPS id out of range: 1 [hevc @ 000001c9b6bb50c0] PPS id out of range: 1 [hevc @ 000001c9b6bb50c0] PPS id out of range: 2 [hevc @ 000001c9b6bb50c0] PPS id out of range: 1 [hevc @ 000001c9b6bb50c0] PPS id out of range: 1 [hevc @ 000001c9b6bb50c0] PPS id out of range: 2 [hevc @ 000001c9b6bb50c0] PPS id out of range: 1 [hevc @ 000001c9b6bb50c0] PPS id out of range: 1 NVEncC (x64) 5.46 (r2126) by rigaya, Mar 5 2022 12:31:25 (VC 1929/Win) OS Version Windows 10 x64 (19043) [UTF-8] CPU AMD Ryzen 7 4800HS with Radeon Graphics [4.31GHz] (8C/16T) GPU #0: NVIDIA GeForce RTX 2060 with Max-Q Design (1920 cores, 1185 MHz)[PCIe3x16][496.49] NVENC / CUDA NVENC API 11.1, CUDA 11.5, schedule mode: auto Input Buffers CUDA, 20 frames Input Info avcuvid: H.265/HEVC, 3840x2160, 60000/1001 fps AVSync vfr Vpp Filters colorspace: cspconv(p010 -> yuv444(16bit)) matrix:bt709->GBR lut3d: table=OMSYSTEM_OM-Log400_BT.2020_to_WDR_BT.709_v1.0.cube size=33, interp=trilinear matrix:GBR->bt709 cspconv(yuv444(16bit) -> yv12) resize(spline36): 3840x2160 -> 1920x1080 cspconv(yv12 -> nv12) Output Info H.265/HEVC main @ Level auto 1920x1080p 1:1 59.940fps (60000/1001fps) avwriter: hevc, #1:pcm_s16le/2ch -> aac/stereo/128kbps => mp4 Encoder Preset quality Rate Control CQP I:20 P:23 B:25 ChromaQPOffset cb:0 cr:0 Lookahead off GOP length 600 frames B frames 3 frames [ref mode: each] Ref frames 3 frames, MultiRef L0:auto L1:auto AQ off CU max / min auto / auto Others mv:auto

om-user avatar Apr 05 '22 07:04 om-user

"PPS id out of range: 1" error looks like a error in libavcodec HEVC parser, it might not be related with lut3d.

Does the encoding crash after this log? If not and it produces output file, you may be able to ignore this warnings.

rigaya avatar Apr 06 '22 09:04 rigaya

Thank you for your quick reply. As you said, when I tried simple command without lut3d, same message were found and output file was produced. What does this message mean? As I mentioned above, input file is 10bit HEVC file with log format.

om-user avatar Apr 06 '22 13:04 om-user

It's message from libavcodec HEVC parser, and I'm not sure for the meaning of it.

NVEnc 6.01 might have fixed this error.

rigaya avatar Aug 26 '22 14:08 rigaya