[英]FFMPEG C++ select GPU
AVDictionary* options = nullptr;
av_dict_set(&options, "hwaccel", "cuvid", 0);
av_dict_set_int(&options, "hwaccel_device", 2, 0);
即使我將 hwaccel 設備指定為 2,它仍然在 GPU 0 上運行。我該如何解決這個問題?
我自己遇到了這個問題。 這是解決方案。 創建 hwdevice ctx 時,您可以傳入指定 gpu 設備的char*
。
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;
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.