itchio / capsule

🎬 Cross-platform hotkey short video capture for games
GNU General Public License v2.0
178 stars 14 forks source link
itchio sharing video-game

capsule

capsule augments any game so that pressing a key records a video+audio clip. Those clips can be easily shared later, see this tweet for example.

It's being developed mainly for integration with the itch.io app, but is designed as a separate pair of projects:

libcapsule is responsible for detecting which video & audio APIs a game uses, and intercepting calls to them so that it may capture video and audio frames.

capsulerun is responsible for launching the game, injecting libcapsule, establishing a connection to it, receiving video and audio frames, encoding, and muxing them.

See Build instructions if you know enough to give it a shot :)

Design goals

Non-goals

Things that are out of scope (ie. that capsule will not officially support):

Status

Core

Linux

macOS

Windows

Build instructions

This project is being ported to Go & Rust. These instructions are OUTDATED.

capsule is a (set of) CMake projects, which handles things like:

Like typical CMake projects, capsule should be built in a subfolder, never directly in the source tree, as you'll see in platform-specific instructions

Building on Linux

Notes: some distributions ship libav, most distributions ship outdated versions of ffmpeg, save yourself some trouble and build x264 and ffmpeg 3.2+ yourself into a prefix. You can then pass it to cmake with -DCAPSULE_DEPS_PREFIX=/path/to/prefix

64-bit and 32-bit versions are built separately. Example of 64-bit build:

cd /path/to/capsule
mkdir build64
cd build64
cmake ..
make install -j4

capsulerun usage:

/path/to/capsule/build64/dist/capsulerun -- path/to/some/game.x86_64

If nothing's happening, the game isn't using OpenGL, you've got the wrong capsule architecture (64-bit for a 32-bit game for example), or there's something capsule doesn't support yet.

NB: Launcher scripts may give you a bit of trouble at the moment, as capsulerun will establish a connection with the shell and not the game, which will fail. This will be addressed later.

Building on macOS

Pretty much the same as Linux, except you don't need to compile x264 & ffmpeg yourself, a stripped-down home-cooked universal build will be downloaded by cmake.

The resulting capsulerun & libcapsule are universal, which means there's no separate 32-bit/64-bit build processes and they should work with every app, no matter what their architecture.

Example build:

cd /path/to/capsule
mkdir build
cd build
cmake ..
make install -j4

capsulerun supports launching .app bundles and invididual executables. Example usage:

/path/to/capsule/build/dist/capsulerun -- path/to/some/Game.app

Building on Windows

Important notes:

You probably won't get anywhere with an MSVC older than 2015.

From the Visual C++ 2015 Native Build Tools Command Prompt, run:

cd C:\path\to\capsule
mkdir build32
cd build32
cmake -G "Visual Studio 14 2015" ..

To compile, run this from the build32 folder:

msbuild INSTALL.vcxproj

(You can use /maxcpucount:n to speed up the build process, since capsule is broken down in a few projects - where n is the maximum number of CPUs you want to use)

To build a 64-bit version, add Win64 to the generator name (the -G parameter).

C:\path\to\capsule\build32\dist\capsulerun.exe -- some_game.exe

NB: Some games with launchers (for example UE4 games) may give you a bit of trouble at the moment, as capsulerun will establish a connection with the launcher and not the game, which will fail. This will be addressed later.

License

capsule is released under the GPL v2 license, see the LICENSE file.

It uses the following libraries:

Some of its code is derived from the following projects:

Special thanks to: