Automated pipeline to extract clips from Counter-Strike 2 demo files.
This tool automates the process of turning a .dem.zst file into individual video clips of a specific player's highlights (or all rounds/deaths).
Example video: https://www.youtube.com/watch?v=g_mOC57Z5gQ
Workflow:
- Decompress: Converts
.dem.zstto.dem. - Parse: Analyzes the demo to find player segments (Round Start -> Death/End).
- Record: Automates CS2 and OBS Studio to record these segments.
- Counter-Strike 2
- OBS Studio
- OBS WebSocket
- Python 3.10+
- .NET 8.0 SDK
-
Install Python Dependencies:
pip install -r src/recorder/requirements.txt
-
Build the Parser:
cd src/parser dotnet build -c Release
If you have a compressed Faceit demo file (.dem.zst), unpack it first.
python src/recorder/unpack_demo.py "input_file.dem.zst" "output_file.dem"Run the C# parser to analyze the demo and generate a segments.json file.
<DEMO_PATH>: Path to the.demfile.<STEAMID64>: The SteamID64 of the player you want to highlight.
.\src\parser\bin\Debug\net8.0\parser.exe "path\to\demo.dem" 76561199032006224Output: segments.json in the project root.
Launch the auto-recorder. This script will:
- Launch CS2.
- Connect to OBS.
- Load the demo.
- Fast-forward to each segment.
- Record the gameplay automatically.
python src/recorder/auto_recorder.py segments.json --autoImportant:
- Do not touch your mouse/keyboard while the recorder is running. It uses the console to control the game.
- The script waits 30 seconds for CS2 to launch.
- It automatically trims dead time (skips freeze time, cuts shortly after death).
You can tweak settings in src/recorder/auto_recorder.py:
self.obs_password: Set this if your OBS WebSocket has a password.start_trim/end_trim: Adjust how much time is cut from start/end of clips.
src/parser/: C# Demo parsing logic.src/recorder/: Python automation scripts.segments.json: generated recording instructions.