Convert Quake Demo Files to Video Using FFmpeg
This article explains how to play and convert video game demo files
(such as Quake .dem files) into standard video formats
using FFmpeg. Because game demo files contain engine telemetry and
player inputs rather than actual video frames, they cannot be directly
converted by FFmpeg. Instead, you must play the demo inside the game
engine and capture or stream the rendering output into FFmpeg to create
a shareable video file.
Why You Cannot Convert Demo Files Directly
Game demo files (with extensions like .dem,
.rec, or .rcy) are not video files. They are
data logs that record player coordinates, camera angles, inputs, and
game events. To view them, the game engine must “replay” these events in
real-time. Because there are no video streams inside a .dem
file, FFmpeg cannot open them directly.
To convert a demo into a video, you must play the demo in-game and record the output.
Step 1: How to Play the Demo File
Before capturing, you must ensure the demo plays correctly inside the game engine.
Place the demo file (e.g.,
mydemo.dem) into your game’s data directory (for Quake, this is usually theid1folder).Launch the game or a modern source port (such as DarkPlaces for Quake).
Open the developer console by pressing the tilde key (
~).Type the play command and press Enter:
play mydemo
Step 2: Convert the Demo to Video Using FFmpeg
There are two primary methods to convert the running demo into a video file using FFmpeg: capturing your screen in real-time, or exporting raw frames from the game engine and encoding them.
Method A: Real-Time Screen Capture with FFmpeg
You can run the game demo in windowed mode and use FFmpeg to record that specific window or your entire screen.
For Windows (using gdigrab): 1. Run your game in
windowed mode. Note the exact title of the window (e.g., “Quake”). 2.
Open your command prompt and run the following FFmpeg command to capture
the window at 60 FPS:
bash ffmpeg -f gdigrab -framerate 60 -i title="Quake" -c:v libx264 -pix_fmt yuv420p output.mp4
3. Play the demo in the game. Press q in the command prompt
to stop recording when the demo ends.
For Linux (using x11grab): 1. Run the game in
windowed mode. 2. Run the following command, adjusting
-video_size to match your game window resolution:
bash ffmpeg -f x11grab -framerate 60 -video_size 1920x1080 -i :0.0 -c:v libx264 -pix_fmt yuv420p output.mp4
Method B: In-Engine Frame Export (Highest Quality)
For the best visual quality without stuttering, you can configure the game engine to output raw video or image sequences during playback, and then compile them with FFmpeg.
1. Export the demo from the game engine: Many Quake
source ports (like DarkPlaces) allow you to capture raw video directly
to your disk. * While playing the demo, open the game console and type:
text cl_capturevideo 1 * This will output a large,
uncompressed .avi file or a sequence of .tga
images in your game folder. Once the demo finishes, turn off capturing
by typing cl_capturevideo 0.
2. Compress the exported file with FFmpeg: Because the exported file from the engine is uncompressed and massive, use FFmpeg to compress it into an efficient MP4 file:
ffmpeg -i captured_video.avi -c:v libx264 -crf 18 -preset slow -c:a aac -b:a 192k final_output.mp4If the engine exported an image sequence (e.g.,
frame_0001.tga, frame_0002.tga), use this
command to compile them into a video:
ffmpeg -framerate 60 -i frame_%04d.tga -c:v libx264 -pix_fmt yuv420p final_output.mp4