I was looking for opencl lut3d filter (i think mpv uses lcms2 + opengl to drive its color-managed output) And there was patch, since last year, but it not yet merged https://ffmpeg.org/pipermail/ffmpeg-devel/2025-June/346001.html also there was inverse tonemapping (SDR to HDR) filter, slo not merged yet https://ffmpeg.org/pipermail/ffmpeg-devel/2025-July/346244.html but I think patch was incomplete? It modifies file that does not exist yet (may be it used normal tonmapping filter sources as renamed base and then added on that?)
On Wed, May 6, 2026 at 5:36 PM Andrew Randrianasulu <randrianasulu@gmail.com> wrote:
I was looking for opencl lut3d filter (i think mpv uses lcms2 + opengl to drive its color-managed output)
And there was patch, since last year, but it not yet merged
https://ffmpeg.org/pipermail/ffmpeg-devel/2025-June/346001.html
Usage after patching ffmpeg git: ./ffmpeg -i ~/6029.mp4 -init_hw_device opencl -vf format=bgra,hwupload,lut3d_opencl=/home/guest/botva/src/src/LinearTransformation/BT601_NTSC_to_BT2020_HLG.cube,hwdownload,format=bgra -frames 10000 -c:v libx264 -preset ultrafast -c:a copy -f mp4 /dev/shm/3dlut.mp4 took me some time to figure out full string.
also there was inverse tonemapping (SDR to HDR) filter, slo not merged yet
https://ffmpeg.org/pipermail/ffmpeg-devel/2025-July/346244.html
but I think patch was incomplete? It modifies file that does not exist yet (may be it used normal tonmapping filter sources as renamed base and then added on that?)
On Wed, May 6, 2026 at 8:02 PM Andrew Randrianasulu <randrianasulu@gmail.com> wrote:
On Wed, May 6, 2026 at 5:36 PM Andrew Randrianasulu <randrianasulu@gmail.com> wrote:
I was looking for opencl lut3d filter (i think mpv uses lcms2 + opengl to drive its color-managed output)
And there was patch, since last year, but it not yet merged
https://ffmpeg.org/pipermail/ffmpeg-devel/2025-June/346001.html
Usage after patching ffmpeg git:
./ffmpeg -i ~/6029.mp4 -init_hw_device opencl -vf format=bgra,hwupload,lut3d_opencl=/home/guest/botva/src/src/LinearTransformation/BT601_NTSC_to_BT2020_HLG.cube,hwdownload,format=bgra -frames 10000 -c:v libx264 -preset ultrafast -c:a copy -f mp4 /dev/shm/3dlut.mp4
took me some time to figure out full string.
speed up for me on h264 (avc1 / 0x31637661), yuv444p(tv, progressive), 1920x1080 is like 13 fps vs 5 fps, so it works I think ? ref. line ./ffmpeg -i ~/Sea_of_life_plus_Mikura_dolphins_test.mp4 -vf lut3d=/home/guest/botva/src/src/LinearTransformation/BT601_NTSC_to_BT2020_HLG.cube -frames 10000 -c:v libx264 -preset ultrafast -c:a copy -f mp4 /dev/shm/3dlut.mp4 ffmpeg version N-123229-gf2e5eff3ff Copyright (c) 2000-2026 the FFmpeg developers built with gcc 11.2.0 (GCC) configuration: --enable-opencl --disable-debug --enable-libx265 --enable-libx264 --enable-gpl --enable-libplacebo --enable-vulkan --enable-libshaderc --enable-libzimg --enable-libaom --enable-libdav1d --enable-libsoxr --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-gnutls --enable-libass --enable-libbluray --enable-libcdio --enable-frei0r --enable-libgsm --enable-openal --enable-libopus --enable-librtmp --enable-libsnappy --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libv4l2 --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwebp libavutil 60. 30.100 / 60. 30.100 libavcodec 62. 30.100 / 62. 30.100 libavformat 62. 15.100 / 62. 15.100 libavdevice 62. 4.100 / 62. 4.100 libavfilter 11. 17.100 / 11. 17.100 libswscale 9. 7.100 / 9. 7.100 libswresample 6. 4.100 / 6. 4.100 Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/home/guest/Sea_of_life_plus_Mikura_dolphins_test.mp4': Metadata: major_brand : isom minor_version : 512 compatible_brands: isomiso2avc1mp41 encoder : Lavf57.41.100 Duration: 00:05:04.74, start: 0.000000, bitrate: 15955 kb/s Stream #0:0[0x1](und): Video: h264 (High) (avc1 / 0x31637661), yuv420p(progressive), 1920x1080 [SAR 1:1 DAR 16:9], 15818 kb/s, 29.97 fps, 29.97 tbr, 360k tbn (default) Metadata: handler_name : VideoHandler Stream #0:1[0x2](und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 128 kb/s (default) Metadata: handler_name : SoundHandler [aost#0:1/copy @ 0xaf8c7c0] Applying unspecific -frames to non video streams, maybe you meant -vframes ? File '/dev/shm/3dlut.mp4' already exists. Overwrite? [y/N] y Stream mapping: Stream #0:0 -> #0:0 (h264 (native) -> h264 (libx264)) Stream #0:1 -> #0:1 (copy) Press [q] to stop, [?] for help [libx264 @ 0xaf89000] using SAR=1/1 [libx264 @ 0xaf89000] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX XOP FMA3 BMI1 [libx264 @ 0xaf89000] profile High 4:4:4 Predictive, level 4.0, 4:4:4, 8-bit [libx264 @ 0xaf89000] 264 - core 163 - H.264/MPEG-4 AVC codec - Copyleft 2003-2021 - http://www.videolan.org/x264.html - options: cabac=0 ref=1 deblock=0:0:0 analyse=0:0 me=dia subme=0 psy=1 psy_rd=1.00:0.00 mixed_ref=0 me_range=16 chroma_me=1 trellis=0 8x8dct=0 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=6 threads=6 lookahead_threads=1 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=0 weightp=0 keyint=250 keyint_min=25 scenecut=0 intra_refresh=0 rc=crf mbtree=0 crf=23.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=0 Output #0, mp4, to '/dev/shm/3dlut.mp4': Metadata: major_brand : isom minor_version : 512 compatible_brands: isomiso2avc1mp41 encoder : Lavf62.15.100 Stream #0:0(und): Video: h264 (avc1 / 0x31637661), yuv444p(tv, progressive), 1920x1080 [SAR 1:1 DAR 16:9], q=2-31, 29.97 fps, 30k tbn (default) Metadata: encoder : Lavc62.30.100 libx264 handler_name : VideoHandler Side data: CPB properties: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: N/A Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 128 kb/s (default) Metadata: handler_name : SoundHandler frame= 231 fps=5.0 q=28.0 size= 7168KiB time=00:00:08.47 bitrate=6928.5kbits/s speed=0.182x elapsed=0:00:46.57 [q] command received. Exiting. [out#0/mp4 @ 0xae93e00] video:8251KiB audio:135KiB subtitle:0KiB other streams:0KiB global headers:0KiB muxing overhead: 0.100687% frame= 256 fps=5.1 q=-1.0 Lsize= 8394KiB time=00:00:08.57 bitrate=8019.1kbits/s speed=0.169x elapsed=0:00:50.59 [libx264 @ 0xaf89000] frame I:2 Avg QP:20.50 size: 10692 [libx264 @ 0xaf89000] frame P:257 Avg QP:19.10 size: 33069 [libx264 @ 0xaf89000] mb I I16..4: 100.0% 0.0% 0.0% [libx264 @ 0xaf89000] mb P I16..4: 19.0% 0.0% 0.0% P16..4: 14.8% 0.0% 0.0% 0.0% 0.0% skip:66.2% [libx264 @ 0xaf89000] coded y,u,v intra: 16.8% 0.4% 1.6% inter: 9.1% 0.6% 1.9% [libx264 @ 0xaf89000] i16 v,h,dc,p: 44% 27% 15% 13% [libx264 @ 0xaf89000] kb/s:7887.21 bash-5.1$ accelerated line: ./ffmpeg -i ~/Sea_of_life_plus_Mikura_dolphins_test.mp4 -init_hw_device opencl -vf format=bgra,hwupload,lut3d_opencl=/home/guest/botva/src/src/LinearTransformation/BT601_NTSC_to_BT2020_HLG.cube,hwdownload,format=bgra -frames 10000 -c:v libx264 -preset ultrafast -c:a copy -f mp4 /dev/shm/3dlut.mp4 ffmpeg version N-123229-gf2e5eff3ff Copyright (c) 2000-2026 the FFmpeg developers built with gcc 11.2.0 (GCC) configuration: --enable-opencl --disable-debug --enable-libx265 --enable-libx264 --enable-gpl --enable-libplacebo --enable-vulkan --enable-libshaderc --enable-libzimg --enable-libaom --enable-libdav1d --enable-libsoxr --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-gnutls --enable-libass --enable-libbluray --enable-libcdio --enable-frei0r --enable-libgsm --enable-openal --enable-libopus --enable-librtmp --enable-libsnappy --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libv4l2 --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwebp libavutil 60. 30.100 / 60. 30.100 libavcodec 62. 30.100 / 62. 30.100 libavformat 62. 15.100 / 62. 15.100 libavdevice 62. 4.100 / 62. 4.100 libavfilter 11. 17.100 / 11. 17.100 libswscale 9. 7.100 / 9. 7.100 libswresample 6. 4.100 / 6. 4.100 [OpenCL @ 0xad8d600] Beignet DRM to OpenCL mapping not usable. Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/home/guest/Sea_of_life_plus_Mikura_dolphins_test.mp4': Metadata: major_brand : isom minor_version : 512 compatible_brands: isomiso2avc1mp41 encoder : Lavf57.41.100 Duration: 00:05:04.74, start: 0.000000, bitrate: 15955 kb/s Stream #0:0[0x1](und): Video: h264 (High) (avc1 / 0x31637661), yuv420p(progressive), 1920x1080 [SAR 1:1 DAR 16:9], 15818 kb/s, 29.97 fps, 29.97 tbr, 360k tbn (default) Metadata: handler_name : VideoHandler Stream #0:1[0x2](und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 128 kb/s (default) Metadata: handler_name : SoundHandler [aost#0:1/copy @ 0xbd9a1c0] Applying unspecific -frames to non video streams, maybe you meant -vframes ? File '/dev/shm/3dlut.mp4' already exists. Overwrite? [y/N] y Stream mapping: Stream #0:0 -> #0:0 (h264 (native) -> h264 (libx264)) Stream #0:1 -> #0:1 (copy) Press [q] to stop, [?] for help [libx264 @ 0xbe0a7c0] using SAR=1/1 [libx264 @ 0xbe0a7c0] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX XOP FMA3 BMI1 [libx264 @ 0xbe0a7c0] profile High 4:4:4 Predictive, level 4.0, 4:4:4, 8-bit [libx264 @ 0xbe0a7c0] 264 - core 163 - H.264/MPEG-4 AVC codec - Copyleft 2003-2021 - http://www.videolan.org/x264.html - options: cabac=0 ref=1 deblock=0:0:0 analyse=0:0 me=dia subme=0 psy=1 psy_rd=1.00:0.00 mixed_ref=0 me_range=16 chroma_me=1 trellis=0 8x8dct=0 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=6 threads=6 lookahead_threads=1 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=0 weightp=0 keyint=250 keyint_min=25 scenecut=0 intra_refresh=0 rc=crf mbtree=0 crf=23.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=0 Output #0, mp4, to '/dev/shm/3dlut.mp4': Metadata: major_brand : isom minor_version : 512 compatible_brands: isomiso2avc1mp41 encoder : Lavf62.15.100 Stream #0:0(und): Video: h264 (avc1 / 0x31637661), yuv444p(tv, progressive), 1920x1080 [SAR 1:1 DAR 16:9], q=2-31, 29.97 fps, 30k tbn (default) Metadata: encoder : Lavc62.30.100 libx264 handler_name : VideoHandler Side data: CPB properties: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: N/A Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 128 kb/s (default) Metadata: handler_name : SoundHandler frame= 2467 fps= 14 q=22.0 size= 67584KiB time=00:01:23.10 bitrate=6662.1kbits/s speed=0.455x elapsed=0:03:02.65 [q] command received. Exiting. [out#0/mp4 @ 0xbcf0f00] video:67172KiB audio:1303KiB subtitle:0KiB other streams:0KiB global headers:0KiB muxing overhead: 0.102630% frame= 2497 fps= 14 q=-1.0 Lsize= 68545KiB time=00:01:23.34 bitrate=6736.9kbits/s speed=0.452x elapsed=0:03:04.46 [libx264 @ 0xbe0a7c0] frame I:10 Avg QP:19.50 size: 48450 [libx264 @ 0xbe0a7c0] frame P:2490 Avg QP:21.52 size: 27464 [libx264 @ 0xbe0a7c0] mb I I16..4: 100.0% 0.0% 0.0% [libx264 @ 0xbe0a7c0] mb P I16..4: 33.9% 0.0% 0.0% P16..4: 23.2% 0.0% 0.0% 0.0% 0.0% skip:42.9% [libx264 @ 0xbe0a7c0] coded y,u,v intra: 6.7% 0.0% 0.1% inter: 8.8% 0.4% 0.4% [libx264 @ 0xbe0a7c0] i16 v,h,dc,p: 31% 31% 15% 22% [libx264 @ 0xbe0a7c0] kb/s:6599.58 bash-5.1$
also there was inverse tonemapping (SDR to HDR) filter, slo not merged yet
https://ffmpeg.org/pipermail/ffmpeg-devel/2025-July/346244.html
but I think patch was incomplete? It modifies file that does not exist yet (may be it used normal tonmapping filter sources as renamed base and then added on that?)
participants (1)
-
Andrew Randrianasulu