Repository navigation
frontend: Sanitise Advanced mode recording filenames - #200
Merged
zackees merged 2 commits intoOct 11, 2026
Merged
Conversation
…786) With the filename format "%CCYY-%MM-%DD %hh:%mm:%ss", Advanced output mode writes recordings whose names keep the ':' while saved replay buffers have it replaced (reported upstream by pricklythorn). AdvancedOutput::StartRecording passes the raw FilenameFormatting setting to GetRecordingFilename and to the split-file "format", whereas the replay buffer, Simple mode recordings, screenshots and the stream dump all go through GetFormatString, which replaces the characters Windows filesystems reject. output_filename_format is the Qt-free form of GetFormatString that every file output can share. The stub returns the format unchanged, as the Advanced recording path does today, so 5 of 6 cases fail: test_recording_format_replaces_colons, test_replay_buffer_format_replaces_colons, test_recording_matches_replay_buffer, test_every_reserved_character_is_replaced and test_subdirectories_in_format_are_kept. test_plain_formats_are_unchanged passes. Refs obs-rust#199. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
With the filename format "%CCYY-%MM-%DD %hh:%mm:%ss", Advanced mode recordings and their split files kept the ':' in their names, while replay buffers, Simple mode recordings and screenshots had it replaced. Such files cannot be written to NTFS or exFAT drives or copied to Windows. Reported upstream by pricklythorn. AdvancedOutput::StartRecording now runs FilenameFormatting through GetFormatString like every other file output, for both the first file and the split-file format. GetFormatString wraps the Qt-free output_filename_format, which replaces * ? " | : > < with '_' and '\' with '/'. Only the format changes; the recording directory is never touched, and subdirectories in the format are kept. test_recording_format_replaces_colons, test_replay_buffer_format_replaces_colons, test_recording_matches_replay_buffer, test_every_reserved_character_is_replaced and test_subdirectories_in_format_are_kept now pass (6/6). Fixes obs-rust#199. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Local-Gate: v1 tree=08724963159cdb2db00f9106c07dba15482a87ec secs=77 lanes=lint:run,rust-test:run,tier2-linux:run Ci-Attestation: {"at":1791696801,"gate":"rust/all/fmt","host":"linux-x86_64","key":"292e234cedff0cea4b95cfac7aa0c24e8ae4ca5f6c2bf61da3d7f372499bf607","lane":"lint","parents":["c558db2ae20dc6c8f290cea5b0eea3efc19fde45"],"secs":11,"stamp":"446fc02f499915554183864c0c951b0d","tree":"08724963159cdb2db00f9106c07dba15482a87ec","v":1,"via":"run"} Ci-Attestation: {"at":1791696801,"gate":"rust/x86_64-unknown-linux-gnu/clippy","host":"linux-x86_64","key":"292e234cedff0cea4b95cfac7aa0c24e8ae4ca5f6c2bf61da3d7f372499bf607","lane":"lint","parents":["c558db2ae20dc6c8f290cea5b0eea3efc19fde45"],"secs":11,"stamp":"1ac26b469b145e89d34de8389f52ac56","tree":"08724963159cdb2db00f9106c07dba15482a87ec","v":1,"via":"run"} Ci-Attestation: {"at":1791696801,"gate":"rust/x86_64-unknown-linux-gnu/test","host":"linux-x86_64","key":"90fdd482a5db00d3ed788a4b3bb023a40268364e1dddc39c864abb334f73af4b","lane":"rust-test","parents":["c558db2ae20dc6c8f290cea5b0eea3efc19fde45"],"secs":24,"stamp":"9a2c750c1df915f8ec67bf7884b22b94","tree":"08724963159cdb2db00f9106c07dba15482a87ec","v":1,"via":"run"} Ci-Attestation: {"at":1791696801,"gate":"cpp/linux-x64/tier2","host":"linux-x86_64","key":"882ab4885f23cdf6b47a7eb460314ae6747179d6648a6c1dc6b80379776615ff","lane":"tier2-linux","parents":["c558db2ae20dc6c8f290cea5b0eea3efc19fde45"],"secs":43,"stamp":"46a7afd1fffc58fd6dd7c0b12d865bbe","tree":"08724963159cdb2db00f9106c07dba15482a87ec","v":1,"via":"run"}
Member
|
Verified locally, rebased onto master and stamped. The new head is
Merging once CI is green, which includes the frontend build. |
zackees
force-pushed
the
fix/199-recording-filename-sanitise
branch
from
October 11, 2026 05:33
215b2ea to
971d4f5
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
In Advanced output mode, recordings kept characters such as
:from the filename format in their names. With%CCYY-%MM-%DD %hh:%mm:%ssa recording was saved as2026-10-11 01:14:55.mkv, while a saved replay buffer, a Simple mode recording or a screenshot with the same format had the:replaced. With this change Advanced mode recordings, and their split files, are sanitised the same way.AdvancedOutput::StartRecording()passed the rawFilenameFormattingsetting toGetRecordingFilename()and to the split-fileformatsetting. Every other file output (replay buffer in both modes, Simple mode recording, screenshots, the multitrack stream dump) first runs it throughGetFormatString(), which replaces* ? " | : > <with_and\with/. libobs'sos_generate_formatted_filename()does not sanitise, so the split files got the raw format too.test: Fail the recording filename format against a stub (upstream #13786): addsoutput_filename_format()infrontend/utility/output-filename-format.c, a Qt-free form ofGetFormatString()that the test builds directly, andtest_output_filename_format. The stub returns the format unchanged, as the Advanced recording path did, so 5 of its 6 tests fail on this commit:test_recording_format_replaces_colonstest_replay_buffer_format_replaces_colonstest_recording_matches_replay_buffertest_every_reserved_character_is_replacedtest_subdirectories_in_format_are_kepttest_plain_formats_are_unchangedpasses: a format without reserved characters is left alone.frontend: Sanitise Advanced mode recording filenames (upstream #13786): moves theGetFormatString()logic intooutput_filename_format()and makesGetFormatString()wrap it, so all callers share one implementation.AdvancedOutput::StartRecording()now usesGetFormatString(filenameFormat, nullptr, nullptr)for both the first file and the split-file format. Only the format changes. The recording directory is never touched, and subdirectories in the format are kept. All 6 tests pass.Motivation and Context
Fixes #199 (upstream obsproject/obs-studio#13786, reported by pricklythorn)
Why this one: Advanced mode users who record to NTFS or exFAT drives, or who later copy their recordings to Windows, get files that cannot be written or cannot be copied. Simple mode and the replay buffer already sanitise, so only Advanced mode recordings behave differently. There is no upstream fix, and this one is small: the behaviour change is two lines in
AdvancedOutput.cpp.How Has This Been Tested?
Automated:
test_output_filename_formatfails 5 of 6 at the RED commit and passes 6 of 6 at the GREEN commit. The test target was rebuilt clean after each checkout. The full tree builds, and all 62 ctest tests pass (built and run on Arch Linux). clang-format 22.1.3 and gersemi 0.25.0 report no changes.End to end, the built
obsran headless (private Xvfb and D-Bus session, throwaway profile) with a color source,FilenameFormatting=%CCYY-%MM-%DD %hh:%mm:%ssand--startrecording:2026-10-11 01:14:55.mkv2026-10-11 01_21_14.mkv2026-10-11 01_21_23.mkv2026-10-11 01_15_14.mkvThe split file in the after run is empty because OBS was stopped right after the split. Its name comes from the muxer's own
os_generate_formatted_filename()call on the format setting, which is the path this change fixes.Not tested:
Types of changes
Checklist:
🤖 Generated with Claude Code