[FFmpeg-devel] Sharing cuda context between transcode sessions to reduce initialization overhead

Timo Rothenpieler timo at rothenpieler.org
Tue Jun 13 01:25:46 EEST 2017


> Global state in the libraries is something we absolutely try to stay away
> from, so this approach is not quite appropriate.
> 
> If you want to somehow share this, it should be in the ffmpeg command line
> tool somewhere, however we also try to reduce hardware specific magic in
> favor of abstractions.

This shouldn't need any hardware specific magic, just setting the 
hw_device_ctx on all nvenc instances. Which is something that could be 
done entirely hardware independent quite easily.
Like, set the hw_device_ctx wherever applicable if "-hwaccel something" 
is set.

I wonder though, what happens in the case that one explicitly wants to 
use multiple GPUs? I guess in that case using an explicit hwupload_cuda 
might be a workaround?


More information about the ffmpeg-devel mailing list