OpenCL Video Filters
Below is a description of the currently available OpenCL video filters.
To enable compilation of these filters you need to configure FFmpeg with --enable-opencl
.
Running OpenCL filters requires you to initialize a hardware device and to pass that device to all filters in any filter graph.
- '-init_hw_device opencl[=name][:device[,key=value...]]'
-
Initialise a new hardware device of type opencl called name, using the given device parameters.
- '-filter_hw_device name'
-
Pass the hardware device called name to all filters in any filter graph.
For more detailed information see https://www.ffmpeg.org/ffmpeg.html#Advanced-Video-options
- Example of choosing the first device on the second platform and running avgblur_opencl filter with default parameters on it.
-init_hw_device opencl=gpu:1.0 -filter_hw_device gpu -i INPUT -vf "hwupload, avgblur_opencl, hwdownload" OUTPUT
Since OpenCL filters are not able to access frame data in normal memory, all frame data needs to be uploaded(hwupload) to hardware surfaces connected to the appropriate device before being used and then downloaded(hwdownload) back to normal memory. Note that hwupload will upload to a surface with the same layout as the software frame, so it may be necessary to add a format filter immediately before to get the input into the right format and hwdownload does not support all formats on the output - it may be necessary to insert an additional format filter immediately following in the graph to get the output in a supported format.