MP4(3)

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

✨ MP4GetNumberOfTracks ✨

okay bestie, so you know how you're digging through an mp4 file and you're like "wait. how many tracks are in here actually" πŸ’­ yeah. this is the girl for that job. she lives in the mp4 library (that's section 3 of the manual, library calls, iykyk) and she counts tracks for you. no cap.


πŸŽ€ SYNTAX πŸŽ€

first things first, you gotta let her in:

#include <mp4.h>

u_int32_t MP4GetNumberOfTracks(
     MP4FileHandle hFile,
     const char* type = NULL,
     u_int8_t subType = 0
)

look at that signature. gorgeous. immaculate. she takes three args and gives you back a u_int32_t. periodt. πŸ’…


🌸 ARGUMENTS 🌸

  • hFile β€” the mp4 file you want to poke at. this is the one you're asking about, so be specific bestie 🫢
  • type β€” the type of track you're counting. pass NULL and she's like "any type, i don't discriminate, i count them all" ✨ (the manpage literally spells it "Species" which is a whole typo moment but we move πŸ’€ β€” point is: it specifies the type of track for which a count is desired). want the actual predefined values? go check MP4GetTrackType().
  • subType β€” now we're getting specific specific. this narrows it down to a subtype of track to be counted. important: subtypes are only defined for audio and video tracks, so if you're out here with some other track type trying to use a subType, that's not a thing. see MP4GetAudioTrackType() and MP4GetVideoTrackType() for the predefined values. a zero value means "any subtype, idc, give me all of them" πŸ’–

πŸ‘‘ RETURN VALUES πŸ‘‘

she returns the number of tracks of the specified type and subType in the mp4 file. that's it. that's the tea. ⭐


πŸ¦‹ DESCRIPTION πŸ¦‹

MP4GetNumberOfTracks tells you how many tracks of the given type and subtype are chillin' inside the mp4 file. that's the whole vibe.

and like, why do you care? so many reasons bestie:

  • to figure out if an mp4 file even contains a track of a given type of media β€” say, audio, or video 🌈
  • to figure out if multiple options might be available β€” think multiple audio tracks in different languages, which is very main character of that file honestly πŸ”₯

and for audio and video tracks specifically? you can hand her a subType and she'll only count tracks of that particular encoding. obsessed. πŸ’œ


πŸ’« SEE ALSO πŸ’«


that's the whole page bestie, go forth and count your tracks πŸŒΈπŸ’–βœ¨

written by Cisco Systems Inc., Version 0.9, and yes it's MP4(3) β€” mwah, ily, stan a good library call πŸ’…πŸŽ€πŸ«Ά
πŸ“¦ where this page comes from