This happens when the MP4 file is not finalized correctly, which happens much more often with longer recording sessions. There is no way to recover a corrupted MP4 recording from OBS, as it uses a dynamic atom (MP4 'repair' tools just take a donor atom from another file and stick it on the end; doesn't work with how OBS records).
Record to FLV instead, as noted. If there are any issues, you'll only lose the last second or two of the recording, instead of the whole thing. Remuxing is easy and fast, especially with OBS Studio (it's an option in the File menu, if I remember correctly).