Repack a progressive MP4 into a single multiplexed fragmented tree
[ftyp, moov(+mvex), moof, mdat, …]. Keyframe-aligned (a fragment starts on a sync
sample so it is independently decodable), lossless (sample bytes via a Phase 8
segment-list mdat), memory-safe. The inverse of ISOMedia.Defragment.
Summary
Functions
Boundary dts values (in the given samples' timescale): greedily take the first sync
sample, then each next sync sample whose dts ≥ previous boundary + target_ts.
Repack a progressive tree into a multiplexed fragmented tree. opts[:target_duration] seconds (default 2.0).
Partition samples into one run per boundary: run i is the samples whose dts is in
[boundaries[i], boundaries[i+1]) (the last run is open-ended). boundaries must be in
the same timescale as the samples, ascending.
Functions
@spec boundaries([ISOMedia.Sample.t()], non_neg_integer()) :: [non_neg_integer()]
Boundary dts values (in the given samples' timescale): greedily take the first sync
sample, then each next sync sample whose dts ≥ previous boundary + target_ts.
@spec fragment( ISOMedia.tree(), keyword() ) :: ISOMedia.tree()
Repack a progressive tree into a multiplexed fragmented tree. opts[:target_duration] seconds (default 2.0).
@spec windows([ISOMedia.Sample.t()], [non_neg_integer()]) :: [[ISOMedia.Sample.t()]]
Partition samples into one run per boundary: run i is the samples whose dts is in
[boundaries[i], boundaries[i+1]) (the last run is open-ended). boundaries must be in
the same timescale as the samples, ascending.
The first window is open-ended on the low end: it includes every sample before
boundaries[1], regardless of whether its dts is less than boundaries[0]. This
preserves any leading non-sync samples (frames before the first keyframe) so that
fragmenting remains lossless.