MP4(3)
π MP4(3) β the MP4 File Format Library era π
okay so bestie, we're in the <mp4.h> cinematic universe, and this page is literally just about ONE little function that's lowkey carrying the whole edit list timeline situation. no cap. let's get into it π
β¨ NAME β¨
MP4GetSampleIdFromEditTime β gets u the sample id of a specified time in the edit list timeline. that's it. that's the whole job. and she does it flawlessly π
πΈ SYNTAX πΈ
#include <mp4.h>
MP4SampleId MP4GetSampleIdFromEditTime(
MP4FileHandle hFile,
MP4TrackId trackId,
MP4Timestamp when,
MP4Timestamp* pStartTime = NULL,
MP4Duration* pDuration = NULL
);
look at those default args, NULL and NULL, so polite, so optional, so demure π«Ά
π¦ ARGUMENTS π¦
hFileβ specifies the mp4 file to which the operation applies. basically which file are we doing this to, bestie, bc we can't just be doing this to a random one πtrackIdβ specifies the track to which the operation applies. which track, babes. be specific.whenβ specifies the time in the track time scale that is desired. this is the moment you're asking about βpStartTimeβ if non-NULL, pointer to variable that will receive the starting timestamp for this sample. β οΈ caveat, and she's important: the timestamp is in the track edit list timescale. not the regular one. the edit list one. noted. πpDurationβ if non-NULL, pointer to variable that will receive the duration for this sample in the edit list timeline. β οΈ caveat the second: the duration is in the track timescale units. yeah, the units are different between these two. iconic of them, honestly.
π RETURN VALUES π
- upon success: the sample id that occurs at the specified time. slay.
- upon an error:
MP4_INVALID_SAMPLE_ID. it's giving "we don't know her" π
π DESCRIPTION π
MP4GetSampleIdFromEditTime returns the sample id of the track sample in which the specified time occurs in the edit list timeline. like, u hand her a time, she hands u back which sample lives there. that's the vibe check and she passes β
the specified time should be in the track time scale. and if ur sitting there like "bestie how do i even get a time value into this time scale" β go look at MP4ConvertToTrackTimestamp() for how to map a time value to this time scale. she'll do the conversion for u π§
now, the important part, and i need u to actually read this one: since the edit list can cause the sample start time and duration to be different that it in the standard track timeline, it is strongly advised that the caller retrieve the new sample start time and duration via this function. like. strongly advised. that's not a suggestion, that's a "girl please pass in pStartTime and pDuration" moment. the edit list rearranges things and if u don't grab the new values from here ur gonna be confused later. periodt π
π₯ SEE ALSO π₯
MP4(3)MP4GetSampleIdFromTime(3)
Cisco Systems Inc. Β· Version 0.9 Β· and the manual page signature is just MP4(3) bc we're classy like that π
okay bye bestie, go get ur sample ids, drink water, and remember: the edit list timescale is NOT the same as the track timescale and that's on purpose πβ¨
π¦ where this page comes from
- fedora 43: libmp4v2-devel 2.1.0-0.34.trunkREV507.fc43 Β· LicenseRef-Callaway-MPLv1.1
- fedora 43: libmp4v2-devel 2.1.0-0.34.trunkREV507.fc43 Β· LicenseRef-Callaway-MPLv1.1
- fedora 44: libmp4v2-devel 2.1.0-0.35.trunkREV507.fc44 Β· LicenseRef-Callaway-MPLv1.1
- fedora 44: libmp4v2-devel 2.1.0-0.35.trunkREV507.fc44 Β· LicenseRef-Callaway-MPLv1.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms