1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
|
# cs2pov
Counter-Strike 2 POV recording automation. Largely AI-assisted and personalized to my system, maybe I'll make this more ubiquitous in the future.
## Installation
### Requirements
- **Python 3.10+**
- **CS2** installed via Steam, with a Steam login
- **FFmpeg** for video/audio capture
- **xdotool** for window automation
- **PulseAudio** for audio capture (pactl)
- **GPU** with Vulkan support (NVIDIA or AMD)
```bash
## Install Python dependencies:
pip install -e .
## Gentoo (based)
emerge -av media-video/ffmpeg x11-misc/xdotool media-sound/pulseaudio
## Ubuntu/Debian (ig)
apt install ffmpeg xdotool pulseaudio-utils
```
## Quick Start
```bash
# Show demo information (players, deaths, spawns)
cs2pov info /path/to/demo.dem
# Record a player's POV (full pipeline: record + trim)
cs2pov pov -d /path/to/demo.dem -p "PlayerName" -o recording.mp4
# Raw recording only (no trimming)
cs2pov record -d /path/to/demo.dem -p "PlayerName" -o raw.mp4
# Trim an existing recording
cs2pov trim raw.mp4 -d /path/to/demo.dem -p "PlayerName"
```
## Commands
### `cs2pov info` - Show Demo Information
Display demo metadata, player list, and death/spawn statistics for each player.
```bash
cs2pov info demo.dem # Human-readable output
cs2pov info demo.dem --json # JSON output
cs2pov info demo.dem -v # Verbose (includes death period details)
```
### `cs2pov pov` - Full Recording Pipeline
Record a player's POV and automatically trim death periods.
```bash
cs2pov pov -d demo.dem -p "PlayerName" -o recording.mp4
cs2pov pov -d demo.dem -p "PlayerName" -o recording.mp4 --tick-nav # Skip deaths in real-time (faster)
cs2pov pov -d demo.dem -p "PlayerName" -o recording.mp4 --no-trim # Skip trimming
```
### `cs2pov record` - Raw Recording Only
Record without post-processing. Useful for batch recording then trimming later.
```bash
cs2pov record -d demo.dem -p "PlayerName" -o raw.mp4
```
### `cs2pov trim` - Trim Existing Recording
Remove death periods from a previously recorded video.
```bash
cs2pov trim raw.mp4 -d demo.dem -p "PlayerName"
cs2pov trim raw.mp4 -d demo.dem -p "PlayerName" -o trimmed.mp4
```
## Common Options
### Recording Options (pov, record)
| Argument | Short | Default | Description |
|----------|-------|---------|-------------|
| `--demo` | `-d` | required | Path to demo file (.dem) |
| `--player` | `-p` | required | Player to record (name or SteamID) |
| `--output` | `-o` | required | Output video file path |
| `--resolution` | `-r` | 1920x1080 | Recording resolution |
| `--framerate` | `-f` | 60 | Recording framerate |
| `--no-hud` | | off | Hide HUD elements |
| `--no-audio` | | off | Disable audio recording |
| `--audio-device` | | auto | PulseAudio device for audio capture |
| `--display` | | 0 | X display number |
| `--cs2-path` | | auto | Path to CS2 installation |
| `--tick-nav` | | off | Skip death periods in real-time during recording |
| `--verbose` | `-v` | off | Verbose output |
### Player Identification
The `--player` argument accepts multiple formats:
- **Player name**: `"PlayerName"` (case-insensitive, partial match supported)
- **SteamID64**: `76561198012345678`
- **SteamID**: `STEAM_0:1:12345678`
- **SteamID3**: `[U:1:12345678]`
## How It Works
1. **Parse demo** - Extract player list and metadata using demoparser2
2. **Preprocess timeline** - Extract death/spawn events and alive segments
3. **Generate config** - Create CS2 CFG file with spectator settings
4. **Copy demo** - Place demo in CS2's replays directory
5. **Launch CS2** - Start CS2 via Steam with the generated config
6. **Wait for demo ready** - Monitor console.log for demo load
7. **Hide demo UI** - Send Shift+F2 to hide playback controls
8. **Start capture** - Launch FFmpeg to record display + audio (PulseAudio)
9. **Recording loop** - Send F5 periodically to keep spectator locked on target player
- **Standard**: Record full demo, trim death periods in post-processing
- **`--tick-nav`**: Detect deaths in real-time via console.log, skip to next round with `demo_gototick`, only trim the brief seek artifacts in post-processing
10. **Wait for demo end** - Monitor console.log for demo completion (or all segments complete with `--tick-nav`)
11. **Finalize** - Stop capture and terminate CS2
12. **Post-process** - Trim death periods or seek artifacts from video
## Noteworthy Issues/Workarounds
### Recording Uses Your Real Display
Due to some framebuffer stuff that's above my head, the tool defaults to `--display 0` (your real display) which means CS will take up your main display while recording. I mostly batch these at night so it's not a huge deal to me, but I'm hoping to experiment with headless recording in the future.
### Close CS2 Before Recording
You can't run multiple instances of CS through one account, so make sure it's closed ahead of time.
### Audio Capture
I'm sorry for making you use Pulseaudio. The audio is captured from your default PulseAudio output so this captures all system audio, not just CS2.
## TODO
- [x] Refactor navigator to make use of tick-based navigation
- [x] Update trimming tool to adhere and account for new navigation system
- [ ] Add audio overlay functionality to trimming tool
|