We do often include affiliate links to earn us some pennies. See more here.

Find you get too much of a performance hit using other recording tools like OBS Studio? Maybe this new tool will help. It doesn't have a fancy name, just called "gpu screen recorder" along with GTK front-end you can use to help manage it.

They claim it's the "fastest screen recording tool for Linux". Why make it? Well, in their own words on how it's different to OBS when paired with NVENC:

OBS only uses the gpu for video encoding, but the window image that is encoded is sent from the GPU to the CPU and then back to the GPU. These operations are very slow and causes all of the fps drops when using OBS. OBS only uses the GPU efficiently on Windows 10 and Nvidia. This gpu-screen-recorder keeps the window image on the GPU and sends it directly to the video encoding unit on the GPU by using CUDA. This means that CPU usage remains at around 0% when using this screen recorder.

In their own testing, they said they saw FPS drops from 30 to 7 with OBS Studio at 4K but with their tool they saw a solid 30FPS. This of course highly depends on your CPU but the point here, is that it uses the full power of your GPU, and seeing a performance loss with OBS on Linux is pretty common.

They have a lot of plans for it including support for AMD and Intel GPUs, the ability to dynamically change bitrate / resolution to match desired fps, see the cursor in the recording and more.

Sounds like a great project, that could be helpful for those of you who want high-performance recordings or something more like Nvidia ShadowPlay perhaps.

Article taken from GamingOnLinux.com.
38 Likes
About the author -
author picture
I am the owner of GamingOnLinux. After discovering Linux back in the days of Mandrake in 2003, I constantly came back to check on the progress of Linux until Ubuntu appeared on the scene and it helped me to really love it. You can reach me easily by emailing GamingOnLinux directly.
See more from me
The comments on this article are closed.
21 comments
Page: 1/3»
  Go to:

dpanter Apr 11, 2022
If you still want OBS, perhaps obs-vkcapture is worth another look. Article from a year ago:
https://www.gamingonlinux.com/2021/03/new-obs-plugin-offers-game-capture-solution-on-wayland-for-vulkan-renderers/
kokoko3k Apr 11, 2022
Another solution for zero copy is to use ffmpeg with kmsgrab.
Yeah, it is not supported by nvidia.

-EDIT-
Quick search revealed others related:
ffmpeg frontend: https://github.com/Saren-Arterius/ussr
zerocopy obs plugin for x11: https://github.com/w23/obs-kmsgrab
zerocopy obs plugin Wayland: https://hg.sr.ht/~scoopta/wlrobs

-EDIT2-

Just made the following, on my system it takes 4% cpu use.
With default values it grabs:
from the first video card found
a portion of 1920x1080
at 30FPS
starting at position 0:0 (upper left)
scales the result to 1280x720
encodes it via vaapi in h264 at excellent quality (and big size ofc).

 
GRAB_SIZE=1920:1080      # How much of the screen you want to grab
GRAB_XY=0:0              # X:Y (upper-left of the grab area; 0:0 is the most upper left)
FRAMERATE=30             # Capture with this framerate
OUTPUT_SCALE=1280:720    # Rescale to this size
CODEC=h264_vaapi         # Video codec, also try hevc_vaapi
QUALITY=18               # Video quality. The higher, the worse.
OUT_FILE=~/video_out.mkv # Write to this output file


ffmpeg -y -device /dev/dri/card0 -f kmsgrab -framerate $FRAMERATE -i - -vaapi_device /dev/dri/renderD128 -vf hwmap=derive_device=vaapi,crop=$GRAB_SIZE:$GRAB_XY,scale_vaapi=$OUTPUT_SCALE:format=nv12 -c:v $CODEC -qp:v $QUALITY $OUT_FILE



Last edited by kokoko3k on 11 April 2022 at 12:47 pm UTC
Corben Apr 11, 2022
Atm I'm using nvidia-patch and obs-nvfbc. Normally I don't have many issues with neither window capture nor full screen capture, but recently, when Cyberpunk didn't get captured and I switched to full screen capture, I saw a massive performance hit. Does not happen at all with nvfbc.

Advantage now is, I don't have to worry about creating a new source for a window capture as I can set the obs-nvfbc source to capture just one of my desktops. And the better performance when capturing.

Disadvantage though, I have to patch the nvidia driver with every release, and it's not officially supported.


Last edited by Corben on 11 April 2022 at 12:08 pm UTC
kokoko3k Apr 11, 2022
Quoting: CorbenAtm I'm using nvidia-patch and obs-nvfbc. Normally I don't have many issues with neither window capture nor full screen capture, but recently, when Cyberpunk didn't get captured and I switched to full screen capture, I saw a massive performance hit. Does not happen at all with nvfbc.

Advantage now is, I don't have to worry about creating a new source for a window capture as I can set the obs-nvfbc source to capture just one of my desktops. And the better performance when capturing.

Disadvantage though, I have to patch the nvidia driver with every release, and it's not officially supported.

If you capture much and have an IGP available, you may consider switching to a PRIME setup so that you will only tax the igp for grabbing and encoding.
ridge Apr 11, 2022
This looks fantastic! When I had an Nvidia GPU, I was using the same framebuffer capture patch Corben posted above, and it worked wonders; but this app looks so much simpler and is definitely a much needed utility for capturing from an Nvidia GPU, OBS is powerful but a lot of people rarely need 90% of what it can offer. It's like slicing cheese with a chainsaw.
Hopefully AMD support works out so I can use it myself :)
SirBubbles Apr 11, 2022
Kind of a necessary project. I use Replay-Sorcery at the moment, and that works great. Downside is that it's basically abandoned, and there's nothing else quite like it at the moment, so I hope a project like this can fill that void.
Needs to be something you can have running in the background, and use a key combo or something to record the last few minutes of what's in ram or something like that. I prefer something that can dump the last few minutes of gameplay to a video file, not something you have to use to start recording beforehand.
RossBC Apr 11, 2022
Quoting: CorbenAtm I'm using nvidia-patch and obs-nvfbc
You can also use nvlax with it's source patch.
 
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 5fa8620..ee2f230 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -16,11 +16,11 @@ project(nvlax CXX)
 include(ExternalProject)
 include(cmake/FetchCPM.cmake)
 
-CPMAddPackage("gh:zyantific/zydis#master")
+CPMAddPackage("gh:zyantific/zydis#55dd08c210722aed81b38132f5fd4a04ec1943b5")
 
 CPMAddPackage(
         NAME LIEF_SRC
-        GIT_TAG master
+        GIT_TAG b65e7cca03ec4cd91f1d7125e717d01635ea81ba
         GITHUB_REPOSITORY lief-project/LIEF
         DOWNLOAD_ONLY YES
 )
@@ -59,7 +59,7 @@ message(STATUS "LIEF library: ${LIEF_LIBRARIES}")
 
 CPMAddPackage(
         NAME PPK_ASSERT
-        GIT_TAG master
+        GIT_TAG 833b8b7ea49aea540a49f07ad08bf0bae1faac32
         GITHUB_REPOSITORY gpakosz/PPK_ASSERT
         DOWNLOAD_ONLY YES
 )

To patch patch both libnvidia-encode and -fbc, unless nvidia massively changes their drivers, so far it has worked on each driver release.

same as the other one though.

sudo find / -iname "libnvidia*"
sudo ./nvlax-encode or ./nvlax-fbc -i /path/to/file/name -o /path/to/file/name
const Apr 12, 2022
When this gets AMD compatibility, it should be a really usefull tool for that steamdeck plugin project. Would be kind of neat if this could be controlled from the ...-menu
kokoko3k Apr 12, 2022
To anyone suggesting ways to circumvent artificially imposed restrictions by nvidia, it is explicitely prohibited by the driver license:

Quote2.1.3 Limitations.

No Modification or Reverse Engineering. Customer may not modify (except as provided in Section 2.1.2), reverse engineer, decompile, or disassemble the SOFTWARE, nor attempt in any other manner to obtain the source code.

In other words, the use of nvidia-patch/nvlax, even suggested by the developer of gpu-screen-recorder for fullscreen captures, is not permitted.


Last edited by kokoko3k on 12 April 2022 at 5:38 pm UTC
While you're here, please consider supporting GamingOnLinux on:

Reward Tiers: Patreon. Plain Donations: PayPal.

This ensures all of our main content remains totally free for everyone! Patreon supporters can also remove all adverts and sponsors! Supporting us helps bring good, fresh content. Without your continued support, we simply could not continue!

You can find even more ways to support us on this dedicated page any time. If you already are, thank you!
The comments on this article are closed.
Buy Games
Buy games with our affiliate / partner links: