YouTube Ingest by Hand (Part 4)
I spent the last day merging the initialization segments and media segments emitted by the two AVAssetWriter's (audio + video). The result at the moment is that VLC won't play it, and YouTube is still broadcasting a black rectangle.
I pulled down some example M4F files from an MPEG-DASH stream. It is split into separate audio and video files. I noticed that the sequence numbers alternate though. I also noticed that it only has one TRUN per file, while the AVAssetWriter files have several.
ChatGPT is experiencing "exceptionally" heavy load, so I'm out in the cold figuring this out on my own. Addiction comes fast.
I'm wondering if the sequence number needs to be increased based on the count of TRUNs...? It's amazing how plainly ChatGPT could no doubt answer that question, and how impossible it has been to try to find that answer with Google.

This makes me wonder if the audio track is actually a requirement, or just something that causes error messages. I'm going to try (temporarily) not handling audio, and just updating the MFHD sequence number based on the TRUN count.
So, that was wrong. The MFHD sequence should correspond to the fragment sequence (as the MFHD atom name would imply).
Next guess: the example M4Fs I've looked at all have one TRUN per TRAK per MOOF while AVAssetWriter has been putting several TRUNs in each.
To be continued.