Shadow Cast is a low-latency, low-overhead, GPU accelerated screen & audio capture utility.
Typical screen capture utilities copy the framebuffer data between host and GPU memory when encoding, causing significant load on the host CPU. This can affect both the running applications and the quality of the resulting media. Shadow Cast captures and encodes the framebuffer directly on the GPU with very little or no performance penalty to running applications. This makes Shadow Cast ideal for capturing gameplay footage, even in the most hardware intensive games. See how it performs.
More examples can be found in this YouTube playlist
You can start a capture session using...
$ shadow-cast [ <OPTIONS> ] <OUTPUT FILE>
The resulting media/container type is determined by the extension of <OUTPUT FILE>
, e.g. .mp4
or .mkv
.
If no OPTIONS
are specified then Shadow Cast will pick some sensible defaults for the audio/video encoders and sample/frame rates, but these can be changed by specifying the following OPTIONS
on the command line...
Option | Description |
---|---|
-A <AUDIO ENCODER> |
Audio encoder. All options available to ffmpeg should work here. Defaults to libopus |
-V <VIDEO ENCODER> |
Video encoder. Available options are h264_nvenc and hevc_nvenc . defaults to hevc_nvenc |
-f <FRAMES PER SECOND> |
Capture FPS. values from 20 to 70 are accepted. defaults to 60 |
-s <SAMPLE RATE> |
Audio sample rate. Defaults to 48000 (NOTE: Some encoders will only support certain sample rates. Shadow Cast will display an error if your chosen sample rate isn't supported) |
Ctrl+C / SIGINT will stop the capture session and finalize the output media.
- FFMpeg (libav)
- NVIDIA GPU, supporting NVENC and NvFBC
- Pipewire
- X11 or Wayland
In order to build Shadow Cast you will need a C++20 compiler, plus the following libraries' headers/libs installed...
- ffmpeg / libav
- X11
- Pipewire
- Wayland (wayland-client, wayland-egl)
- libdrm
These can usually be obtained through your Linux distribution's package manager using the -devel
packages of each.
After obtaining the source, change to the project's directory and run the following commands...
$ mkdir ./build
$ cd ./build
$ cmake ..
$ cmake --build .
TIP: You may be able to speed up the cmake --build .
step by appending -- -j$(nproc)
Following the steps to build, above, you can install the built binary using...
$ sudo ./install-helper.sh
By default, Shadow Cast will be installed to /usr/local/bin
. If you wish to install to a different location, run the following command before running the above install step...
$ cmake -DCMAKE_INSTALL_PREFIX=<INSTALL_DIR> ..
... replacing <INSTALL_DIR>
with your custom install path (E.g. $HOME/.local
, /opt
, etc.)
This will install the binary to <INSTALL_DIR>/bin/shadow-cast
. Once installed, you must ensure that <INSTALL_DIR>/bin
is in your $PATH
.
Shadow Cast takes most of its inspiration from this project and it has been a very helpful reference. It seems to be the only other alternative that offers the same (if not better) performance and ease-of-use characteristics. gpu-screen-recorder offers AMD and Intel support in addition to NVIDIA.
This is the utility I used for capture prior to creating Shadow Cast. You can capture an X display using the ffmpeg -f x11grab ...
command. In my experience, the performance when capturing gameplay footage is pretty terrible, and the resulting media will often contain lots of frame drops / tearing (Example of x11grab
vs Shadow Cast on YouTube).
Admittedly, I've never used this software. I'm aware that it is very popular for capturing / streaming but I don't really consider it to align with my use-cases. I much prefer a simple / small utility, where it is quick to setup a capture.