On 2024-05-31 10:53, Martin Storsjö wrote:
This allows ending up with a normal, non-fragmented file when
the file is finished, while keeping the file readable if writing
is aborted abruptly at any point. (Normally when writing a
mov/mp4 file, the unfinished file is completely useless unless it
is finished properly.)

This results in a file where the mdat atom contains (and hides)
all the moof atoms that were part of the fragmented file structure
initially.
---
This is, incidentally, how Apple devices do (or at least did, at some
point) their writing of files when recording, at least with some
of their userspace APIs.
---
Should the ftyp atom also be updated to remove brands no longer required for non-fragmented files? I'm not sure how important that is in real-world scenarios, so it might not be worth it to deal with some of the additional changes required e.g. to deal with the new ftyp possibly being a different size.

Since coincidentally I've implemented the exact same feature in a different application a couple weeks ago I'll also throw in the fun fact that files produced this way can be smaller than regular MP4s for long and/or large files. This is due to the lack of interleaving of A/V samples resulting in the file having much fewer but larger chunks, which means the moov atom - mainly the stco/co64 and stsc boxes - can be much smaller.

Also good to know that Apple thought of this as well. I had no idea about that, but that further justifies adopting this method for achieving resilient but compatible recordings in my mind.

~ Dennis
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Reply via email to