> ## Documentation Index
> Fetch the complete documentation index at: https://cordial.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Recording gameplay

> Save a session as a video file, with the game's own sound, started and stopped with F9.

Roblox's own Record Video button does nothing on the Android client, and nothing in Cordial can change that. Cordial can record for it, because it owns the window the engine draws into: it reads each finished frame out of its own swapchain and hands it to `ffmpeg`.

It needs `ffmpeg` on your `PATH`. The Flatpak runtime ships one, so the Flatpak has it; on other installs it is the `ffmpeg` package.

**Press F9 in the game window to start recording, and F9 again to stop.** The window title carries `REC` while it runs, and the key never reaches the game.

## Turn it on

<Steps>
  <Step title="Press F9, or switch recording on in Settings">
    F9 works whenever the game window has focus, with no setting involved. Each press toggles: the first starts a file, the second finishes it, and the next press starts another. Control+F9 and Alt+F9 still go to the game.

    Settings has **Record gameplay**, which records every session from its first frame instead, and **Record sound too**. They apply the next time Cordial starts, not to a game already running.
  </Step>

  <Step title="Play">
    A recording started with the switch ends when you close Cordial. One started with F9 ends at the next press, or when you close Cordial.
  </Step>

  <Step title="Find the file">
    Files are named `Cordial-2026-10-15_18-07-11.mp4`.

    * **Not in the Flatpak:** `~/Videos/Cordial/` (or your `XDG_VIDEOS_DIR`).
    * **In the Flatpak:** `~/.var/app/io.github.luohoa97.Cordial/data/cordial/profiles/<profile>/recordings/`. The Flatpak has no access to `~/Videos`, so it records into its own data instead.

    Set `CORDIAL_RECORD_DIR` to choose another folder.
  </Step>
</Steps>

<Note>
  F9 is also the key Roblox uses for its developer console on desktop. If a game you play needs it, set `CORDIAL_RECORD_KEY` to another key (below) or to `off`.
</Note>

## What you get

MP4 with H.264 where `ffmpeg` has libx264. Where it does not, which is the Flatpak runtime's `ffmpeg`, WebM with VP9. The container follows what the encoder can fill; it never writes a WebM called `.mp4`. The frame rate is 30 unless you set `CORDIAL_RECORD_FPS` (1 to 120).

Playback runs at the speed you played, not faster: the engine draws one frame a second when nothing is moving, and the recorder fills the gaps with the last frame.

If you resize the window while recording, the file ends and a new one starts beside it (`Cordial-…-2.mp4`), because a video cannot change size part way.

An MP4 is written in fragments, so one cut off by a crash or a full disk still plays up to the cut.

## Sound

Off until you switch on **Record sound too** (or set `CORDIAL_RECORD_AUDIO=game`). It records what the game plays and nothing else: Cordial copies the audio it hands to your sound server, so music in another window, a call, or a notification is not in the file. That holds on PipeWire, PulseAudio, ALSA and OSS alike.

If you want everything you can hear, other programs included, set `CORDIAL_RECORD_AUDIO=desktop`. That reads the default output's monitor through PulseAudio, and a call on another desktop would be in the file.

Sound is stereo. A game that plays surround is folded down to two channels. In a test with generated frames the sound came about 30 ms ahead of the picture, one frame; a real game has not been measured.

A game that has played nothing gives a silent track, and the log says how many streams were open when the recording ended (`[record] audio: 12.4 s written, 1 stream(s) open at the end`). Zero streams means the engine never opened audio, which is a different fault from a recording that lost it.

The window title marker is on Wayland only. On X11 the key and the log lines work and the title does not change.

## What it costs

Each captured frame holds the engine's present for a few milliseconds while it is copied: 2.5 to 3.4 ms at 1280x754 on one Intel GPU, measured at 30 and 60 captured frames a second. If the encoder cannot keep up, frames are dropped rather than slowing the game; the summary line at the end of the log counts them.

<Accordion title="Other ways to start and stop, and the variables">
  For scripts: run the client with `CORDIAL_DEV_CONTROL=1` and use the development control surface (`record start`, `record stop`, `record status`, or `cordial_record` in the MCP). Pressing F9 through `cordial_key` (evdev code 67) toggles recording the same way the real key does, and `tone <hz> <seconds>` (`cordial_tone` in the MCP) plays a quiet tone through Cordial's audio path, which is how to check what a recording hears when the game itself is silent.

  | Variable | Meaning |
  | - | - |
  | `CORDIAL_RECORD` | `1` for the default folder, or a folder, or a file ending `.mp4`, `.webm` or `.mkv`. Recording starts at the first frame. |
  | `CORDIAL_RECORD_DIR` | The default folder. |
  | `CORDIAL_RECORD_FPS` | Frames a second, 1 to 120. |
  | `CORDIAL_RECORD_AUDIO` | `game` (also `1`, `on`), `desktop`, or `off`. |
  | `CORDIAL_RECORD_KEY` | The toggle key: `F1` to `F10`, `F12`, `Pause`, `ScrollLock`, or `off`. Default `F9`. A name that is none of these turns the key off and says so in the log. |

  The client log says what was chosen (`[record] recording to … (libx264 at 30 fps, audio: the game's own sound)`, `[record] hotkey: F9 starts and stops recording while the game window has focus`) and, at the end, how many frames were written and dropped.

  Recording cannot be switched on or off from Settings while a game runs yet; the two switches are read at launch. F9 is the way to do it mid-game.
</Accordion>

Why it is built this way: [ADR-059](/adr/ADR-059-recording-is-the-swapchain-read-on-a-timer-handed-to-ffmpeg).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.