Question / Help No NVENC Option Available for Encoding with Geforce GT 740M

chillmeister93

New Member
I have a Nvidia Geforce GT 740M GPU which is based on the Kepler architecture which supposedly supports NVENC (https://www.notebookcheck.net/NVIDIA-GeForce-GT-740M.89900.0.html), but in my OBS settings the only encoder options I have are x264 and QuicSync H.264 (see attached image).

A friend of mine has the Nvidia Geforce GT 750M, which is from the same GPU family, and he has the option to use NVENC, which is why I am confused why I odnt have the option?

Am I missing something? I have just updated to the most recent nvidia driver and still no success

Thanks in advance for the help

Log file: https://obsproject.com/logs/z3-wY483rRd_WLcp

Edit: Have just checked Nvidia's website and this seems to indicate that the 740M should support NVENC? Annotation 2020-04-14 145756.png
 

Attachments

  • Annotation 2020-04-14 144616.png
    Annotation 2020-04-14 144616.png
    37.8 KB · Views: 683
  • Annotation 2020-04-14 145756.png
    Annotation 2020-04-14 145756.png
    44.9 KB · Views: 794
Last edited:

FerretBomb

Active Member
I believe that in older versions of OBS Studio some of the 700-series cards were blacklisted, as during that generation some were equipped with NVENC, and some were still not. Unsure if they have been removed from the blacklist in 25.0.4, if it still persists, or if there's a way to override the blacklist.
I may also be misremembering and it may have been the 600-series with that, but IIRC some in the 700 also were affected.
 

chillmeister93

New Member
I believe that in older versions of OBS Studio some of the 700-series cards were blacklisted, as during that generation some were equipped with NVENC, and some were still not. Unsure if they have been removed from the blacklist in 25.0.4, if it still persists, or if there's a way to override the blacklist.
I may also be misremembering and it may have been the 600-series with that, but IIRC some in the 700 also were affected.
Thanks for the info. Is there anyway to try override the blacklist?
 

FerretBomb

Active Member
That'd be a question for a dev like @R1CH (sorry for the tag). As I'd said, I'm unsure if there's a way to override it, or even if it's still in place.
 

chillmeister93

New Member
That'd be a question for a dev like @R1CH (sorry for the tag). As I'd said, I'm unsure if there's a way to override it, or even if it's still in place.
Thanks, would be interesting to know if my card is on the blacklist (and how to possibly get around it). Have done some fairly extensive research on this now and everything I've read up til this point leads me to believe that my card should support NVENC
 

Sukiyucky

Member
static const wchar_t *blacklisted_adapters[] = {
L"720M", L"730M", L"740M", L"745M", L"820M", L"830M",
L"840M", L"845M", L"920M", L"930M", L"940M", L"945M",
L"1030", L"MX110", L"MX130", L"MX150", L"MX230", L"MX250",
L"M520", L"M500", L"P500", L"K620M",
};
 

FerretBomb

Active Member
Welp. Answers that part at least, yes, the 740M is on the blacklist while your buddy's 750M is not.
Still no idea if there's a 'hidden' launch option/flag to bypass the blacklist to give it a try anyway, but the official (well, wiki) list says no:

If there isn't, the only way to try it out and see would be to download a dev environment+tools and the codebase from GitHub, remove that card from the list, compile it, and see if it works. A bit much for most folks.
 

chillmeister93

New Member
Thanks so much for the info guys. Bummer that the blacklist is still in place. Any idea if that will be revoked in the near future?
I've done some dev work so I could try mod the codebase and compile it myself, but I don't really feel like going through all that if there could be a possible simpler solution from the devs
 

Salasar

New Member
Hi all, I recently run into the same issue with my Toshiba Satellite equipped with one of the blacklisted GT 740M.
I did the work to compile my own version of OBS Studio 26. There is only one file to be modified. I commented out line 51 to 53 witch contains 3 versions of the 740M.
After compiling I found there is only one file "obs-ffmpeg.dll" to replace. Yes it is as simple as:
- close OBS
- Replace C:\Program Files\obs-studio\obs-plugins\64bit\obs-ffmpeg.dll
- Start OBS

The NVENC encoder is already preselected by OBS:
OBS_settings_output.png


The source file to be modified is...

obs-ffmpeg.c:
C:
#include <obs-module.h>
#include <util/platform.h>
#include <libavutil/avutil.h>
#include <libavcodec/avcodec.h>
#include <libavformat/avformat.h>

#include "obs-ffmpeg-config.h"

#ifdef _WIN32
#include <dxgi.h>
#include <util/dstr.h>
#include <util/windows/win-version.h>
#endif

OBS_DECLARE_MODULE()
OBS_MODULE_USE_DEFAULT_LOCALE("obs-ffmpeg", "en-US")
MODULE_EXPORT const char *obs_module_description(void)
{
    return "FFmpeg based sources/outputs/encoders";
}

extern struct obs_source_info ffmpeg_source;
extern struct obs_output_info ffmpeg_output;
extern struct obs_output_info ffmpeg_muxer;
extern struct obs_output_info ffmpeg_mpegts_muxer;
extern struct obs_output_info replay_buffer;
extern struct obs_output_info ffmpeg_hls_muxer;
extern struct obs_encoder_info aac_encoder_info;
extern struct obs_encoder_info opus_encoder_info;
extern struct obs_encoder_info nvenc_encoder_info;

#if LIBAVUTIL_VERSION_INT >= AV_VERSION_INT(55, 27, 100)
#define LIBAVUTIL_VAAPI_AVAILABLE
#endif

#ifdef LIBAVUTIL_VAAPI_AVAILABLE
extern struct obs_encoder_info vaapi_encoder_info;
#endif

#ifndef __APPLE__

static const char *nvenc_check_name = "nvenc_check";

#ifdef _WIN32
static const int blacklisted_adapters[] = {
    0x1298, // GK208M [GeForce GT 720M]
    0x1140, // GF117M [GeForce 610M/710M/810M/820M / GT 620M/625M/630M/720M]
    0x1293, // GK208M [GeForce GT 730M]
    0x1290, // GK208M [GeForce GT 730M]
    0x0fe1, // GK107M [GeForce GT 730M]
    // 0x0fdf, // GK107M [GeForce GT 740M]        ----commented out to enable NVENC
    // 0x1294, // GK208M [GeForce GT 740M]        ----commented out to enable NVENC
    // 0x1292, // GK208M [GeForce GT 740M]        ----commented out to enable NVENC
    0x0fe2, // GK107M [GeForce GT 745M]
    0x0fe3, // GK107M [GeForce GT 745M]
    0x1140, // GF117M [GeForce 610M/710M/810M/820M / GT 620M/625M/630M/720M]
    0x0fed, // GK107M [GeForce 820M]
    0x1340, // GM108M [GeForce 830M]
    0x1393, // GM107M [GeForce 840M]
    0x1341, // GM108M [GeForce 840M]
    0x1398, // GM107M [GeForce 845M]
    0x1390, // GM107M [GeForce 845M]
    0x1344, // GM108M [GeForce 845M]
    0x1299, // GK208BM [GeForce 920M]
    0x134f, // GM108M [GeForce 920MX]
    0x134e, // GM108M [GeForce 930MX]
    0x1349, // GM108M [GeForce 930M]
    0x1346, // GM108M [GeForce 930M]
    0x179c, // GM107 [GeForce 940MX]
    0x139c, // GM107M [GeForce 940M]
    0x1347, // GM108M [GeForce 940M]
    0x134d, // GM108M [GeForce 940MX]
    0x134b, // GM108M [GeForce 940MX]
    0x1399, // GM107M [GeForce 945M]
    0x1348, // GM108M [GeForce 945M / 945A]
    0x1d01, // GP108 [GeForce GT 1030]
    0x0fc5, // GK107 [GeForce GT 1030]
    0x174e, // GM108M [GeForce MX110]
    0x174d, // GM108M [GeForce MX130]
    0x1d10, // GP108M [GeForce MX150]
    0x1d12, // GP108M [GeForce MX150]
    0x1d11, // GP108M [GeForce MX230]
    0x1d13, // GP108M [GeForce MX250]
    0x1d52, // GP108BM [GeForce MX250]
    0x1c94, // GP107 [GeForce MX350]
    0x137b, // GM108GLM [Quadro M520 Mobile]
    0x1d33, // GP108GLM [Quadro P500 Mobile]
    0x137a, // GM108GLM [Quadro K620M / Quadro M500M]
};

static const size_t num_blacklisted =
    sizeof(blacklisted_adapters) / sizeof(blacklisted_adapters[0]);

static bool is_blacklisted(const int device_id)
{
    for (size_t i = 0; i < num_blacklisted; i++) {
        const int blacklisted_adapter = blacklisted_adapters[i];
        if (device_id == blacklisted_adapter) {
            return true;
        }
    }

    return false;
}

typedef HRESULT(WINAPI *create_dxgi_proc)(const IID *, IDXGIFactory1 **);

static bool nvenc_device_available(void)
{
    static HMODULE dxgi = NULL;
    static create_dxgi_proc create = NULL;
    IDXGIFactory1 *factory;
    IDXGIAdapter1 *adapter;
    bool available = false;
    HRESULT hr;
    UINT i = 0;

    if (!dxgi) {
        dxgi = GetModuleHandleW(L"dxgi");
        if (!dxgi) {
            dxgi = LoadLibraryW(L"dxgi");
            if (!dxgi) {
                return true;
            }
        }
    }

    if (!create) {
        create = (create_dxgi_proc)GetProcAddress(dxgi,
                              "CreateDXGIFactory1");
        if (!create) {
            return true;
        }
    }

    hr = create(&IID_IDXGIFactory1, &factory);
    if (FAILED(hr)) {
        return true;
    }

    while (factory->lpVtbl->EnumAdapters1(factory, i++, &adapter) == S_OK) {
        DXGI_ADAPTER_DESC desc;

        hr = adapter->lpVtbl->GetDesc(adapter, &desc);
        adapter->lpVtbl->Release(adapter);

        if (FAILED(hr)) {
            continue;
        }

        // 0x10de = NVIDIA Corporation
        if (desc.VendorId == 0x10de && !is_blacklisted(desc.DeviceId)) {
            available = true;
            goto finish;
        }
    }

finish:
    factory->lpVtbl->Release(factory);
    return available;
}
#endif

#ifdef _WIN32
extern bool load_nvenc_lib(void);
#endif

static bool nvenc_supported(void)
{
#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(58, 9, 100)
    av_register_all();
#endif

    profile_start(nvenc_check_name);

    AVCodec *nvenc = avcodec_find_encoder_by_name("nvenc_h264");
    void *lib = NULL;
    bool success = false;

    if (!nvenc) {
        goto cleanup;
    }

#if defined(_WIN32)
    if (!nvenc_device_available()) {
        goto cleanup;
    }
    if (load_nvenc_lib()) {
        success = true;
        goto finish;
    }
#else
    lib = os_dlopen("libnvidia-encode.so.1");
#endif

    /* ------------------------------------------- */

    success = !!lib;

cleanup:
    if (lib)
        os_dlclose(lib);
#if defined(_WIN32)
finish:
#endif
    profile_end(nvenc_check_name);
    return success;
}

#endif

#ifdef LIBAVUTIL_VAAPI_AVAILABLE
static bool vaapi_supported(void)
{
    AVCodec *vaenc = avcodec_find_encoder_by_name("h264_vaapi");
    return !!vaenc;
}
#endif

#ifdef _WIN32
extern void jim_nvenc_load(void);
extern void jim_nvenc_unload(void);
#endif

#if ENABLE_FFMPEG_LOGGING
extern void obs_ffmpeg_load_logging(void);
extern void obs_ffmpeg_unload_logging(void);
#endif

bool obs_module_load(void)
{
    obs_register_source(&ffmpeg_source);
    obs_register_output(&ffmpeg_output);
    obs_register_output(&ffmpeg_muxer);
    obs_register_output(&ffmpeg_mpegts_muxer);
    obs_register_output(&ffmpeg_hls_muxer);
    obs_register_output(&replay_buffer);
    obs_register_encoder(&aac_encoder_info);
    obs_register_encoder(&opus_encoder_info);
#ifndef __APPLE__
    if (nvenc_supported()) {
        blog(LOG_INFO, "NVENC supported");
#ifdef _WIN32
        if (get_win_ver_int() > 0x0601) {
            jim_nvenc_load();
        } else {
            // if on Win 7, new nvenc isn't available so there's
            // no nvenc encoder for the user to select, expose
            // the old encoder directly
            nvenc_encoder_info.caps &= ~OBS_ENCODER_CAP_INTERNAL;
        }
#endif
        obs_register_encoder(&nvenc_encoder_info);
    }
#if !defined(_WIN32) && defined(LIBAVUTIL_VAAPI_AVAILABLE)
    if (vaapi_supported()) {
        blog(LOG_INFO, "FFMPEG VAAPI supported");
        obs_register_encoder(&vaapi_encoder_info);
    }
#endif
#endif

#if ENABLE_FFMPEG_LOGGING
    obs_ffmpeg_load_logging();
#endif
    return true;
}

void obs_module_unload(void)
{
#if ENABLE_FFMPEG_LOGGING
    obs_ffmpeg_unload_logging();
#endif

#ifdef _WIN32
    jim_nvenc_unload();
#endif
}

I don't know if there is a chance for this file to work on other Systems. For the YES-case the file for a Win10 64Bit OBS Studio v26 installation is attached. Use it at your own risk.

Hope I could help someone
 

Attachments

  • obs-ffmpeg.zip
    57.2 KB · Views: 593

Salasar

New Member
Not yet. Unfortunately I still had problems. Maybe I was a little hasty with my post, I guess you expected that, hence the question ;-)
 

koala

Active Member
These are blacklisted for a reason. If the reason is still valid, I doubt you actually get a working nvenc. The blacklist isn't for harassing users, it's to remove nvenc from showing up on devices where it wouldn't work, even if it was offered by the driver. In the past, there were many reports here on the forum where people selected nvenc from the drop down list, but nvenc refused to work.

But if you're able to make nvenc actually work, please report here so the devs might review the blacklist.
 

Salasar

New Member
These are blacklisted for a reason.
Basically, of course, you are right. During my research I came across several reports that the 740M supports NVENC. The TO and this:
https://obsproject.com/forum/threads/please-remove-gt740m-from-the-nvenc-blocklist.126225/
are just 2 examples. Because of this, I have only just started to investigate the situation more closely. I had already installed v22, the GPU worked perfectly with NVENC (log attached) I also have a working v26 (log attached) @R1CH . But since I'm not a programmer, I have to learn a lot before I can successfully complete this project, a lot of trial and error.
In the past, there were many reports here on the forum where people selected nvenc from the drop down list, but nvenc refused to work.
According to my research, there are at least 2 versions of the GP 740M with code names GK107 and GK208, so both Keppler architecture. However, there appears to be a limitation with both; NVENC only works with "rate_controle" "VBR" and "CBR" but not with "lossless". Which in turn corresponds to this table:
 

Attachments

  • v22_2020-12-04 12-58-22.txt
    18.5 KB · Views: 104
  • v26_2020-12-04 13-11-16.txt
    17.3 KB · Views: 95

Salasar

New Member
Correction as I cannot edit my first post:

After compiling I found there is only one file "obs-ffmpeg.dll" to replace. Yes it is as simple as:
- close OBS
- Replace C:\Program Files\obs-studio\obs-plugins\64bit\obs-ffmpeg.dll
- Start OBS

I didn't get it to run properly with this method, instead I reinstalled the whole project to test whether everything worked as expected under v26. Everything looks good, only restriction is you cannot use "lossless" quality control. Logs are attached in previous Posts.
 
Top