MP4(3)

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

✨ MP4(3) β€” the MP4 File Format Library, bestie edition ✨

okay so this is a page from the MP4 File Format Library, and it's about MP4CloneTrack β€” the lil function that makes you a whole clone of a track. it's giving copy-paste but make it ✨cinematic✨. let's get into it πŸ’…


🌸 NAME 🌸

MP4CloneTrack β€” Make a clone of a specified track 🫢


πŸŽ€ SYNTAX πŸŽ€

#include <mp4.h>

MP4TrackId MP4CloneTrack(
     MP4FileHandle srcFile,
     MP4TrackId srcTrackId,
     MP4FileHandle dstFile = MP4_INVALID_FILE_HANDLE,
     MP4TrackId dstHintTrackReferenceTrack = MP4_INVALID_TRACK_ID
)

look at that signature. gorgeous. iconic. no notes. 🌈


πŸ’– ARGUMENTS πŸ’–

  • srcFile β€” Specifies the mp4 file of the source track of the operation. this is where the original track lives, bestie. the source. the origin story. 🌱
  • srcTrackId β€” Specifies the track id of the track to be cloned. like, which track are we duplicating? point at it and say "that one". πŸ‘‰πŸ’…
  • dstFile β€” Specifies the mp4 file of the new, cloned track. If the value is MP4_INVALID_FILE_HANDLE, the new track is created in the same file as the source track. so like, either you send the clone to a different file, or it just moves in right next door to its original. no cap. 🏠✨
  • dstHintTrackReferenceTrack β€” When cloning a hint track, this parameter specifies the track id of the reference track in the destination file. hint-track-specific behaviour, iykyk. 🧚

⭐ RETURN VALUES ⭐

Upon success, the track id of the new track. Upon an error, MP4_INVALID_TRACK_ID. so like β€” happy path, you get a shiny new track id 🎁; sad path, you get the invalid one and you gotta go debug. 😭


πŸ¦‹ DESCRIPTION πŸ¦‹

MP4CloneTrack creates a new track to an mp4 file that is a copy of an existing track with respect to the track media type, and other control information. it's the vibe check, the metadata, the control info β€” all cloned over. πŸ‘‘

⚠️ but listen, this is the important part: Note this function does not copy the media samples of the source track to the new track. the actual samples? not included. the clone is out here with the whole fit but no content. πŸ’€

If you want to do that use MP4CopyTrack() instead. that's the one that actually brings the samples along for the ride. πŸš—


πŸ”₯ SEE ALSO πŸ”₯


Version 0.9, brought to you by Cisco Systems Inc. β€” mwah, thank you for coming to my ted talk, slay responsibly, and remember: clone the track, not the trauma πŸ’–βœ¨πŸŽ€πŸ¦‹πŸŒΈπŸ’…πŸ«ΆπŸ‘‘

πŸ“¦ where this page comes from