obs-ffmpeg: Add error text for NVENC AVERROR_EXTERNAL

Since new NVENC still falls back, try to make the error from ffmpeg
NVENC more actionable for users.
master
Richard Stanway 2020-04-12 17:32:57 +02:00
parent 5e3e9c1f13
commit 15781073dc
1 changed files with 18 additions and 5 deletions

View File

@ -91,11 +91,24 @@ static bool nvenc_init_codec(struct nvenc_encoder *enc)
ret = avcodec_open2(enc->context, enc->nvenc, NULL); ret = avcodec_open2(enc->context, enc->nvenc, NULL);
if (ret < 0) { if (ret < 0) {
struct dstr error_message = {0}; struct dstr error_message = {0};
dstr_printf(
&error_message, // special case for common NVENC error
"Failed to open NVENC codec: %s" if (ret == AVERROR_EXTERNAL) {
"\r\n\r\nPlease check your video drivers are up to date.", dstr_printf(&error_message,
av_err2str(ret)); "Failed to open NVENC codec: %s\r\n\r\n"
"Check your video drivers are up to "
"date. Disable other software that may "
"be using NVENC such as NVIDIA "
"ShadowPlay or Windows 10 Game "
"DVR.",
av_err2str(ret));
} else {
dstr_printf(
&error_message,
"Failed to open NVENC codec: %s\r\n\r\n"
"Please check your video drivers are up to date.",
av_err2str(ret));
}
obs_encoder_set_last_error(enc->encoder, error_message.array); obs_encoder_set_last_error(enc->encoder, error_message.array);
dstr_free(&error_message); dstr_free(&error_message);
warn("Failed to open NVENC codec: %s", av_err2str(ret)); warn("Failed to open NVENC codec: %s", av_err2str(ret));