Friday, October 03, 2025

Accelerated remap with OpenCL - did not work out

 Using the hardware accelerated remap_opencl filter instead of the remap filter (as used in python-ffmpeg-warp) along with hardware accelerated video encoding with nvenc may not be so straightforward - 

https://superuser.com/questions/1819926/how-to-use-ffmpeg-opencl-filters-that-are-accelerated-with-nvenc

Lots of errors even with Gemini's suggestions like

ffmpeg -init_hw_device opencl -c:v hevc -i 'short_w.mp4' -i map_x_directp2.exr -i map_y_directp2.exr \ -filter_complex \ "[0:v]format=p010le,hwupload[vupload]; \ [vupload][1:v][2:v]remap_opencl[vremap]; \ [vremap]hwdownload,format=yuv420p[vout]" \ -filter_hw_device opencl \ -map "[vout]" -map 0:a \ -c:v libx264 -crf 18 warped_opencl_output_final.mp4

Detailed stackoverflow post, 

"Please take into account any overheads that mechanisms introduced by filter chains such as hwupload and hwdownload may introduce into your pipeline, as uploading textures to and from system memory and the accelerator in question will affect performance, and so will format conversion operations (via the format filter) where needed/required."

"You will need to compile your own ffmpeg build using their extensions - see https://developer.nvidia.com/ffmpeg for instructions as the standard binary does not include these capabilities."

(So, did not go this route, and stuck to remap instead of remap_opencl.)

No comments:

Post a Comment