Resource icon

How to: Fix MP4/MOV files corrupting when OBS Studio crashes

If you're reading this, you're probably either using MKV and got tired of waiting for remuxes, or already lost a recording or two. I accientally found a fix for this, so I'm sharing it here.

In Settings>Output, paste the following line into "Custom Muxer Settings":
movflags=frag_keyframe+empty_moov

If you need pictures, I have them:
screenshots.png


Now you can select MP4 or MOV and not worry about losing recordings if OBS Studio crashes while recording. Want to try it? Start recording, record for at least 4 seconds, then kill obs-ffmpeg-mux.exe and obs64.exe in Task Manager. Your MP4/MOV recording will still open in video players and video editors.

For those who are curious: this tells the ffmpeg muxer to create a so-called "fragmented MP4". Normally, an MP4/MOV file must always contain a moov atom, but it can't be known until the entire file is done encoding, so if the encoder or the muxer crash during the output, the whole file becomes unusable. When doing fragmented MP4, each GOP becomes its own "fragment" and no moov atom is necessary, so in the event of a crash you will lose, at worst, a single GOP - the last one that was being written at the time of crash. The default GOP size in Simple output mode is 250 frames (4.1 seconds at 60 FPS or 8.2 at 30). The extra muxing overhead increases file size very slightly (mine increased in size by 6 KB or 0.1%), but this beats losing the entire recording, right?
Top