obs-studio icon indicating copy to clipboard operation
obs-studio copied to clipboard

Add optional disk-based storage for Replay Buffer

Open Alunixa opened this issue 5 months ago • 0 comments

Description

Implemented a disk-based storage mode for the Replay Buffer. Users can now choose to store the replay buffer in a temporary circular file on an SSD/HDD instead of RAM.

Key changes:

  • Added a "Storage Mode" dropdown in Settings -> Output -> Advanced -> Replay Buffer.
  • Increased the maximum storage limit to 8TB for Disk mode (RAM mode still respects memory safety limits).
  • Implemented a ring-buffer on disk in obs-ffmpeg-mux.c that overwrites the oldest packets when the limit is reached.
  • Ensured efficient I/O by only reading the data back when the user triggers a "Save Replay" action.

image

Motivation and Context

Currently, Replay Buffer is RAM-only, which can lead to system instability or crashes when users with limited RAM want to capture long or high-bitrate replays. This feature enables virtually unlimited replay duration by utilizing local high-speed storage (SSDs).

How Has This Been Tested?

  • Hardware: AMD R5 5600 + RTX 3060 12GB + RAM 32GB
  • OS: Windows 11 25H2
  • Tests:
    • Verified standard RAM storage still works as expected.
    • Verified Disk storage creates a temporary file and correctly manages wrap-around overwriting.
    • Successfully saved multiple replays in Disk mode; output files are valid and high-quality.
    • Confirmed temporary files are deleted upon stopping the buffer or closing OBS.

Types of changes

  • New feature (non-breaking change which adds functionality)
  • Tweak (non-breaking change to improve existing functionality)

Checklist:

  • [x] I have read the contributing document: https://github.com/obsproject/obs-studio/blob/master/CONTRIBUTING.md
  • [x] My code has been run through clang-format: https://github.com/obsproject/obs-studio/blob/master/.clang-format
  • [x] My code follows the project's style guidelines: https://github.com/obsproject/obs-studio/blob/master/CODESTYLE.md
  • [x] My code is not on the master branch
  • [x] My code has been tested
  • [x] All commit messages are properly formatted and commits squashed where appropriate
  • [x] I have included updates to all appropriate documentation.

Note to Maintainers 👇 This feature is entirely optional and disabled by default. Users can choose not to enable it, as it is provided specifically for those who require extended replay durations without consuming system memory. Standard OBS functionality and performance remain unaffected, ensuring a safe merge.

Thank you for taking the time to review my pull request!

---Gardenia---AlunixaTeams.

Alunixa avatar Jun 15 '26 16:06 Alunixa