MP4(3)

πŸ“¦ version 2.1.0, in fedora 43, fedora 44

✨ MP4(3) ✨

okay so this is a page from the MP4 File Format Library manual, bestie, and we're about to get into it πŸ’–


πŸ’… NAME πŸ’…

MP4DeleteTrack β€” deletes a track, fr fr. like, gone. bye. 🫢


🌸 SYNTAX 🌸

first things first, you gotta pull in the header:

#include <mp4.h>

and then the actual call looks like this:

bool MP4DeleteTrack(
     MP4FileHandle hFile,
     MP4TrackId trackId
)

that's the whole vibe. two things go in, one bool comes out ✨


πŸŽ€ ARGUMENTS πŸŽ€

  • hFile β€” this is the mp4 file we're doing the operation on. the main character, lowkey πŸ‘‘
  • trackId β€” and this is the track we're doing the operation to. the one getting yeeted πŸ™ˆ

⭐ RETURN VALUES ⭐

  • if it goes well: true (aka 1) πŸŽ‰
  • if it goes bad: false (aka 0) πŸ’€

that's it. that's the whole range of outcomes. iconic.


πŸ¦‹ DESCRIPTION πŸ¦‹

so MP4DeleteTrack deletes the control information that's associated with the track you specified. and bestie, listen β€” if this call succeeds, that trackId becomes invalid. like, it's not a valid id anymore. don't come for it later, it's not there πŸ’€

⚠️ but here's the part you CANNOT skip: the samples that belong to this track are not deleted by this call. nope. not even a little bit.

so how do you actually get rid of them? via MP4Optimize(). that's the move 🫢

and the reason it's like this is actually so real β€” multiple tracks can reference the same samples, so you can't just nuke them from one track's perspective. you have to take a global view when deleting them. like, look at the whole situation before you start deleting things. main character energy but for the entire file 🌈


πŸ’œ SEE ALSO πŸ’œ

  • MP4(3) β€” go read it, iykyk

and that's the whole page, bestie!! this one's from Cisco Systems Inc., sitting at Version 0.9 β€” so like, early days, vintage era, still ate πŸ’…βœ¨ mwah, go delete a track responsibly πŸŽ€

πŸ“¦ where this page comes from