Bug Report Multiple instances of OBS Studio overwrite the same file while recording

RytoEX

Forum Admin
Forum Moderator
Developer
OBS Studio 0.14.2 64-bit (+ Browser Source)
OS: Windows 10 64-bit
CPU: Intel Core i5-3570K @ 3.40GHz
Memory: 16GB
Video Card: NVIDIA GeForce GTX 760
Video Driver: 365.19 (May 13, 2016)

Problem
Starting a recording at the same time in multiple instances of OBS Studio will cause them to output to the same filename, even when "Advanced > Recording > Overwrite if file exists" is not checked.

Steps to Reproduce
  1. Open two instances of OBS Studio.
  2. Click "Start Recording" in both instances within 1 second of each other.
    Alternatively, set a Global Hotkey for "Start Recording", and hit that hotkey.
  3. Record some footage.
  4. Click "Stop Recording" in both instances in any order.
  5. Open the resulting video file to observe that it is mangled.
Actual Behavior
The resulting file is corrupted.

Expected Behavior
There are two uniquely named files, one from each OBS Studio instance.

Workaround
Do not use a global hotkey for "Start Recording" when using multiple instances of OBS Studio. Click "Start Recording" in each instance with at least 1 second of time between them. Double check your output folder to see if a video file has been created from the previous instance before you start recording in another instance.


Background
I've been trying to experiment with creating two separate recordings when gaming: one recording shows whatever is being sent to stream (game, overlays, different scene, etc.), while the other recording only shows the game footage itself. I ran into a few challenges such as:
  1. one OBS Studio instance cannot record two different scenes to two files simultaneously
  2. cannot use Game Capture on the same executable more than once simultaneously
  3. not enough CPU for the game and three x264 encoders for stream plus two recordings
To solve #1, I used two different OBS Studio instances. For #2, I had to use Window Capture on the game in the second OBS Studio instance (though, I had to enable the software cursor in the game to get Window Capture to capture the game's custom cursor instead of the Windows cursor). To solve #3, I switched the recordings from using x264 to using NVENC. It's not perfect, and I'm sure I could make tweaks to improve things, but it seems to work okay.

However, I just ran into the problem described above. I had not enabled the "Advanced > Recording > Overwrite if file exists" option, so I figured if there was any filename conflicts, OBS Studio would deal with it and create a new file by appending something to the filename. Alas, I should've tested this beforehand, because I ended up with a 41 minute long corrupted video file. I don't know if this is a bug within OBS Studio, ffmpeg, or whatever is being used to actually create the output file. I also don't know if this happens on other operating systems or in OBS Classic.

I've attached and uploaded the log files from both instances of OBS Studio used to reproduce this behavior. You can see that I started recording in both at about 20:19:45, give or take a fraction of a second. This resulted in a single file "2016-06-13 20-19-44.mp4" being created that was mangled. In the first log file, I also started a recording in only that instance at 20:22:26.558, which resulted in a perfectly fine file "2016-06-13 20-22-26.mp4" being created.

I thought I'd read in a guide somewhere to wait a few seconds between starting recordings in multiple instances of OBS, but I can't seem to find it now.

2016-06-13 20-19-27.txt at Pastebin
2016-06-13 20-19-37.txt at Pastebin
 

Attachments

  • 2016-06-13 20-19-27.txt
    19.4 KB · Views: 5
  • 2016-06-13 20-19-37.txt
    17.4 KB · Views: 3

o-bee-ess

New Member
Years later, some other person walks past the same point...

The workaround seems about right: click start on each instance individually instead of using the global shortcut to start both simultaneously
 

JohnPee

Member
I am going to add a little bit of folk wisdom here unrelated to your particular issue but I have seen many times in this forum, don't record in MP4 use MKV as the recording format and transcode afterwards. MP4 files if hit by a glitch during recording may be unrecoverable, whereas MKV files can be.
 
Top