News for hackers. Stuff that matters.
Re:Writing an MP4 Muxer for Fun and Profit by CrendKing on Thursday July 18, 2024 @08:44PM (#41001106)
Can someone explain how does an existing media player understand the new mdat format without modification? I assume if they find a completed moov at end of the file, it would recognize the file as a unfragmented mp4. It should then try to find a list of recognized codecs directly inside the mdat (like in the first picture), but instead they will find another moov, a bunch of moofs and sub-mdats, all of which are clearly not proper for a unfragmented mp4. Why doesn't the player report this as a "unrecognizable, badly formatted" mp4 file?
Re:Writing an MP4 Muxer for Fun and Profit by der_rod on Thursday July 18, 2024 @09:28PM (#41001351)
The mdat box does not have a defined structure, and the specification actually states that attempting to define a structure is almost certainly a mistake. In order to find the data the player is looking for it has to read the moov box, which contains the byte offsets and sizes of "chunks" of data. Since there is no requirement for chunks to be contiguous, or even in the same file, we can simply skip over the fragmentation-related boxes within the data box.
Re:Writing an MP4 Muxer for Fun and Profit by Andrews54757 on Thursday July 18, 2024 @08:54PM (#41001168)
The moov contains a list of byte offsets which the player can use to directly access media data. You can skip the moofs and other headers inside by using gaps in the offsets.