KMSGrab is a zero-copy method of capturing screen in GNU/Linux. This plugin adds kmsgrab functionality into OBS Studio.
Most of the code made by w23 (https://github.com/w23/) , scaledteam fixed bug with frame drops, fixed losting capture after switching between fullscreen windows and ported it into latest OBS Studio.
Since dmabuf (kmsgrab) capture require root to work, to make it usable from user account you need to add special caps to it:
sudo setcap cap_sys_admin+ep /usr/local/bin/obs
While building you can encounter strange problem,
CMake Warning at CMakeLists.txt:15 (project): VERSION keyword not followed by a value or was followed by a value that expanded to nothing.
To fix it you need to add version number manually
cmake .. -DOBS_VERSION_OVERRIDE=28.1.0-kmsgrab
git clone https://github.com/scaledteam/obs-studio
mkdir build
cd build
cmake .. -DENABLE_WEBSOCKET=OFF -DENABLE_VST=OFF -DENABLEVLC=OFF -DENABLE_BROWSER=OFF -DENABLE_AJA=OFF -DOBS_VERSION_OVERRIDE=28.1.0-kmsgrab
make -j$(nproc)
sudo checkinstall --default --fstrans=no --backup=no --pkgversion="$(date +%Y%m%d)" --deldoc=yes --pkgname=obs-studio-local-kmsgrab
sudo ldconfig
sudo setcap cap_sys_admin+ep /usr/local/bin/obs
I use Debian Testing (2022-11-04) with Gnome and Wayland (previously used with X11), obs-studio compiled with this parameters:
cmake .. -DCMAKE_C_FLAGS=-march=native -DCMAKE_CXX_FLAGS=-march=native -DENABLE_WEBSOCKET=OFF -DENABLE_VST=OFF -DENABLE_VLC=OFF -DENABLE_AJA=OFF -DENABLE_SCRIPTING=OFF -DENABLE_SCRIPTING_LUA=OFF -DENABLE_SCRIPTING_PYTHON=OFF -DENABLE_DECKLINK=OFF -DOBS_VERSION_OVERRIDE=28.1.0-kmsgrab -DCCACHE_SUPPORT=OFF -DENABLE_PIPEWIRE=OFF -DENABLE_WHATSNEW=OFF -DENABLE_SPEEXDSP=OFF -DENABLE_BROWSER=OFF
And similar setup with Browser:
cmake .. -DCMAKE_C_FLAGS=-march=native -DCMAKE_CXX_FLAGS=-march=native -DENABLE_WEBSOCKET=OFF -DENABLE_VST=OFF -DENABLE_VLC=OFF -DENABLE_AJA=OFF -DENABLE_SCRIPTING=OFF -DENABLE_SCRIPTING_LUA=OFF -DENABLE_SCRIPTING_PYTHON=OFF -DENABLE_DECKLINK=OFF -DOBS_VERSION_OVERRIDE=28.1.0-kmsgrab -DCCACHE_SUPPORT=OFF -DENABLE_PIPEWIRE=OFF -DENABLE_WHATSNEW=OFF -DENABLE_SPEEXDSP=OFF -DCEF_ROOT_DIR=/home/scaled/git/obs-build-dependencies/cef_binary_5060_linux64
OBS Studio <https://obsproject.com>
OBS Studio is software designed for capturing, compositing, encoding, recording, and streaming video content, efficiently.
It's distributed under the GNU General Public License v2 (or any later version) - see the accompanying COPYING file for more details.
- Website: https://obsproject.com
- Help/Documentation/Guides: https://github.com/obsproject/obs-studio/wiki
- Forums: https://obsproject.com/forum/
- Build Instructions: https://github.com/obsproject/obs-studio/wiki/Install-Instructions
- Developer/API Documentation: https://obsproject.com/docs
- Donating/backing/sponsoring: https://obsproject.com/contribute
- Bug Tracker: https://github.com/obsproject/obs-studio/issues
- If you would like to help fund or sponsor the project, you can do so via Patreon, OpenCollective, or PayPal. See our contribute page for more information.
- If you wish to contribute code to the project, please make sure to read the coding and commit guidelines: https://github.com/obsproject/obs-studio/blob/master/CONTRIBUTING.rst
- Developer/API documentation can be found here: https://obsproject.com/docs
- If you wish to contribute translations, do not submit pull requests. Instead, please use Crowdin. For more information read this page: https://obsproject.com/wiki/How-To-Contribute-Translations-For-OBS
- Other ways to contribute are by helping people out with support on our forums or in our community chat. Please limit support to topics you fully understand -- bad advice is worse than no advice. When it comes to something that you don't fully know or understand, please defer to the official help or official channels.