I'm writing app to use on PCs with more than one GPU, I'm trying to get a list of GPU indexes that can decode stream in h264 to assign all new video source equally between all available GPU.
I've fount how to do it in command prompt but i need to write line belong it in c++
ffmpeg -vsync 0 -i input.mp4 -c:v h264_nvenc -gpu list -f null –
I need it to dynamically pass it to av_hwdevice_ctx_create(AVBufferRef**,char *int)
Does anyone know how to do this?
As far as I know you don't need to pass the device explicitly to
the
device_ctx
can be NULL, because it gets created here. You only need to know the type you desire. e.g.AV_HWDEVICE_TYPE_CUDA
. The remaining parameters can be NULL or 0. At least that's how it's done in the hw_decode example:(Note: I haven't used the function myself. I'm just basing my answer on the how it's done in the example.)