mp4 encode is flawed

TheMindVirus

New Member
You'll want to have a look at this: https://github.com/TheMindVirus/moovatom/blob/main/indev/final_report.txt
OBS Studio's .mp4 encoder is flawed and produced a corrupt-at-source 3GB video file for 15-minutes worth of 1-time video.
The mandatory_atoms_V2.py script I wrote shows that many duplicates of required atoms have been inserted into the video stream
and Windows and Linux FFMPEG can't read or repair the blanked-out metadata (which is integral but keeps moving).
The audio is present and plays correctly, the duration is known. The issue is with the video stream metadata being missing
and several video playback utilities not being able to deduce the correct frame size and rate for correct playback.
This is an urgent issue which needs attention to avoid data loss. I have done my side of the work, OBS Studio developers need to fix this yesterday.
 

Lawrence_SoCal

Active Member
I'm only a user... not a developer..
I suspect a more direct reporting submission at https://github.com/obsproject/obs-studio/issues might help ... maybe??
Further, as Recording to MP4 is strongly discouraged for well-documented reasons, and I'm unaware (other than laziness) why anyone would record to an unsafe-for-recording format, I suspect MP4 recording isn't a priority (I sure wouldn't make it so... but that's just me). And yes, I do realize there are some edge use cases where direct recording to MP4 may make sense.
On my i7-10700K system with a NVMe drive, an OBS automated remuxing of a 11GB MKV to MP4 takes under 20 seconds.

Good luck on resolving
 

Suslik V

Active Member
You can use fragmented recording to make your next recordings more durable to power loss etc (when mp4 file becomes incomplete).

official ideas:
 

TheMindVirus

New Member
1. MP4 recording is not lazy, the encoding is lazy. There is a proper way to encode MP4 and OBS Studio does not follow it.
2. OBS Studio depends heavily on FFMPEG for encoding mp4 files, even when FFMPEG itself is flawed.
3. https://github.com/FFmpeg/FFmpeg/bl...6f180d31c5802/libavcodec/mpeg4videoenc.c#L997
- this is the exact line that is causing the issue for me, next to a flag called "FF_BUG_MS", selectively not encoding the correct colour-space.
4. Fragmented Recording is not an option for me, as isn't Redundant Recording. It needs to work every time and those options are not default.
5. I would suggest this software behaviour has been deliberately introduced into the package in spite, developer or not, this needs immediate attention to prevent further data loss.
 

Suslik V

Active Member
mp4 boxes usually written on end of the recording process, until this happen, the required data were kept in the RAM, so self contained fragmented file recording can do the job (of course, this still not excludes disk, RAM and transfer failures).

And in general, you need to provide the steps to reproduce the issue (how to make a broken recording). Log-file from the recording attempt is welcomed (different OBS versions shipped with different encoding libs etc, etc).
 

Kurazarrh

New Member
I have since repaired the video by hand. The entire contents of the video were integral, all except the size of the `stsz` header relative to the `stco` header was not encoded by OBS/FFMPEG. https://github.com/TheMindVirus/moovatom#update
Can you share how you fixed your video by hand? I'm recording to .mkv and I'm getting the exact same issue you were having. It makes my video editors hate the files, and anytime I do any kind of cut or transition in the middle of such a clip, it inserts a black frame. =/
 
Top