Skip to content

Captures the desktop of NVIDIA GPUs to a V4L2 loopback device using their NvFBC API.

License

Notifications You must be signed in to change notification settings

t1stm/nvfbc-v4l2

Repository files navigation

nvfbc-v4l2

Miss obs-nvfbc? Need a replacement? This project is for you!

This project is a tool (hack) for Linux that uses the Nvidia NvFBC API and passes the captured frames to a v4l2loopback device.

Because why not? It's better than nothing!

Requirements:

  • A Nvidia GPU that supports NvFBC. (if it wasn't obvious)
  • A Linux Desktop with CMake and GCC installed.
  • Proprietary Nvidia Drivers. (maybe. I haven't tested it with the open-source drivers yet)
  • X11 as a display server.

Installation:

In short: CMake

But how?

Like this:

$ git clone https://github.com/t1stm/nvfbc-v4l2.git
$ cd nvfbc-v4l2
$ mkdir build && cd build
$ cmake ..
$ make -j$(nproc)

Running:

If you have worked with v4l2loopback before:

$ ./nvfbc-v4l2 -h

If you haven't:

  1. Create a v4l2loopback device.

IMPORTANT: replace x and y with actual numbers and remember them.

$ sudo modprobe v4l2loopback devices=1 video_nr=x card_label="NvFBC Capture" exclusive_caps=1

...or if you want to use the OBS Virtual Camera:

If you don't have any other capture devices set x to 0, and if you do, set it to the highest device number + 1

$ sudo modprobe v4l2loopback devices=2 video_nr=x,y card_label="OBS Virtual Camera, NvFBC Capture" exclusive_caps=1,1
  1. Optional: List all available displays.
$ ./nvfbc-v4l2 -l
  1. Use the virtual v4l2loopback device and optionally the selected screen.
$ ./nvfbc-v4l2 -o [v4l2-nr] -s [screen]
  1. Profit

Screenshot of Desktop in OBS

If the capture appears corrupted, try removing the v4l2loopback module and adding it again with the commands above. If that doesn't help, open up an issue, and I'll try my best to help. Remember to close the program while doing this.

Special Thanks To:

  • umläute (umlaeute) - Developer of the v4l2loopback Linux module. | Without his work, this tool won't exist.
  • Florian Zwoch (fzwoch) - Developer of the obs-nvfbc plugin. | I read his plugin's code to understand the NvFBC API.
  • The Nvidia Capture SDK devs | For making the API easy to use.

Known Issues:

* V4L2 device doesn't show in Chromium-based applications, due to the BGRA444 color space being used.

About

Captures the desktop of NVIDIA GPUs to a V4L2 loopback device using their NvFBC API.

Topics

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published