AVDictionary* options = nullptr;
av_dict_set(&options, "hwaccel", "cuvid", 0);
av_dict_set_int(&options, "hwaccel_device", 2, 0);
Even though I specify hwaccel device to be 2, it still runs on GPU 0. How can I fix this?
Ran into this issue myself. Here is the solution. When you create the hwdevice ctx you can pass in a char*
specifying the gpu device.
int gpu_id = 1;
std::string d = std::to_string(gpu_id);
const char * device = d.c_str();
int err = 0;
if ((err = av_hwdevice_ctx_create(&hw_device_ctx, type,
device, NULL, 0)) < 0) {
return err;
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.