[FFmpeg-user] question about opencl use in decoders/encoders

Dennis Mungai dmngaie at gmail.com
Tue Nov 7 23:35:23 EET 2023

On Tue, 7 Nov 2023 at 00:55, Andrew Randrianasulu <randrianasulu at gmail.com>

> FFmpeg today support some opencl filters (but I was unable to use them
> freely in Cinelerra-gg probably because they require not just
> initialization of hw device but also manual up and download of data ...)
> but I wonder if same opencl infra can be used in decoders and encoders too?
> https://cml.news/g/cml-raw-log-hdr/topic/braw_codec_analysis/25749037?p=,,,20,0,0,0::recentpostdate%2Fsticky,,,20,2,0,25749037
> apparently those big player codecs use it, so it should be possible
> technically, just at some dev time cost ...
> there is also some prores gpu accelerated decoder (closed source, win)
> https://mogurenko.com/2020/11/15/cuda-optimized-prores-decoder/
> and of course old standby mjpeg:
> https://github.com/nctu-pp/mjpeg-encoder
> (opencl part does not seems to work for me, but may be it basically
> artefact of running in 32bit x86 mode , I filled mesa bug about it

Hello Andrew,

I hope this email finds you well.
In FFmpeg, OpenCL is primarily utilized in specific filters, a list of them
which you can verify in your build(s) with OpenCL enabled via :

ffmpeg -filters | grep opencl

On the encoding side, to the best of my knowledge, the libx264 encoder
wrapper implements lookahead (LA) bits that can be offloaded to an OpenCL
capable GPU.
Some users have reported potential performance gains in production, even
upstream where there's still consensus on whether this feature should be
See this merge request's comments on the same:

Separate from FFmpeg:

1. There are also implementations of VP9 encoders utilizing OpenCL-based
offloading, such as the VP9 encoder by Ittiam systems:
whose code can be viewed here https://github.com/ittiamvpx/libvpx
2. A VP8 OpenCL-based encoder: https://github.com/Aazmp/vp8oclenc
3. And other derivatives of (1) above:

I had also posted on this mailing list earlier regarding OpenCL somewhere
in ~2018, may require verification for correctness:

Hope that helps :-)

More information about the ffmpeg-user mailing list