Skip to content

bug: frontend: Advanced-mode recording filenames are not sanitised (upstream #13786) #199

Closed

Description

@rdoupe

Upstream OBS bug, reported by pricklythorn in obsproject/obs-studio#13786. Code unchanged in this fork.

Location

frontend/utility/AdvancedOutput.cpp:823-845: AdvancedOutput::StartRecording() passes the raw FilenameFormatting to GetRecordingFilename() and to the split-file "format" setting. Every other output path goes through GetFormatString() (frontend/OBSApp.cpp:1641-1690), which calls remove_reserved_file_characters() (* ? " | : > < → _): the replay buffer (AdvancedOutput.cpp:910, SimpleOutput.cpp:856), Simple-mode recording (SimpleOutput.cpp:865), screenshots and the stream dump.

Class

Logic error: inconsistent filename sanitising.

How it is reached

Advanced output mode, a filename format containing a reserved character such as %CCYY-%MM-%DD %hh:%mm:%ss. Reproduced headlessly with the unmodified build:

  • Advanced mode wrote 2026-10-11 01:14:55.mkv
  • Simple mode wrote 2026-10-11 01_15_14.mkv

Split files in Advanced mode keep the : as well. On Linux/Btrfs the name is valid (the reporter's case), but recording to an NTFS or exFAT drive fails, and the files can't be copied to Windows.

Proposed fix and failing test

Fix: in AdvancedOutput::StartRecording(), format the filename with GetFormatString(filenameFormat, nullptr, nullptr) like every other path, and use it for both the first file and the split format. Only the format string changes; the recording directory never does, and / subdirectories in the format are kept.

RED test (cmocka, test_output_filename_format): the formatting moves into a Qt-free frontend/utility/output-filename-format.{h,c} helper (GetFormatString becomes a thin wrapper), following the multitrack-ladder pattern so the test needs neither Qt nor libobs. 5 of 6 tests fail today (colons replaced for recording and replay buffer, recording matches replay buffer, every reserved character, subdirectories kept); plain formats pass unchanged. With the fix all 6 pass, and headless Advanced mode with size-based splitting writes 2026-10-11 01_16_45.mkv and the split 2026-10-11 01_16_55.mkv.

Activity

  1. rdoupe commented on Oct 11, 2026

    @rdoupe
    CollaboratorAuthor

    Claiming: this issue.

    1. RED: test_output_filename_format (5 of 6 failing), formatting moved into a Qt-free helper with no behaviour change.
    2. GREEN: Advanced-mode recording uses the same sanitised format as every other output path.
      PR within the hour.
  2. rdoupe commented on Oct 11, 2026

    @rdoupe
    CollaboratorAuthor

    @pricklythorn you reported this in obsproject/obs-studio#13786, so a heads-up: it's fixed here in obs-rust by #200.

    Cause: in Advanced output mode, recordings (and their split files) used the raw filename format, while Simple mode, the replay buffer, screenshots and the stream dump all go through the formatter that replaces * ? " | : > < with _.

    Workaround on stock OBS: avoid : (and the other reserved characters) in Settings → Advanced → Recording → Filename Formatting, e.g. %CCYY-%MM-%DD %hh-%mm-%ss.

    obs-rust is an AI-assisted fork of OBS; on Arch it's obs-studio-rust-git in the AUR.

    If you get a chance to try it, a short reply here on whether it fixes it for you would really help, especially if it does not.

  3. pricklythorn commented on Oct 11, 2026

    @pricklythorn

    Can confirm that it does sanitise the filename correctly for recordings and replay buffer saves.

  4. rdoupe commented on Oct 11, 2026

    @rdoupe
    CollaboratorAuthor

    @pricklythorn thanks for testing it, and for checking replay buffer saves too. That's the confirmation the fix needed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions