segmenter

package
v0.0.0-...-dec19c8 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 17, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BoxStoreFunc

type BoxStoreFunc func(context.Context, string, mp4ff.BoxStructure, uint64) error

type Segmenter

type Segmenter struct {
	// contains filtered or unexported fields
}

Segmenter segments progressive mp4 according to predefined segment duration. Resulting segments are passed to boxStoreFunc, and it is up to user to define how to store them.

Segmentation flow: 1) Make segmentation time-points using first video track 2) Make sample intervals that represent future segments 3) Create init segments for each supported track 4) Create data segments for each supported track

This flow uses high-level functions, implemented in segmentation package.

Configured segment duration should be treated like 'preference'. Segmenter can increase it if necessary in order to make segments with equal sizes.

Tracks get new numbers since they will be in separate files. For example, if input file has video track with ID 0 and audio with ID 1, then in resulting video segments will be single track with ID 0, and in resulting audio segments will be single track also with ID 0.

Approach is taken from https://github.com/Eyevinn/mp4ff/tree/master/examples/segmenter.

func NewSegmenter

func NewSegmenter(
	logger *zap.Logger,
	mdatRS io.ReadSeeker,
	segDuration time.Duration,
	boxStoreFunc BoxStoreFunc,
) *Segmenter

func (*Segmenter) GetSegmentDuration

func (s *Segmenter) GetSegmentDuration() time.Duration

func (*Segmenter) SegmentMP4

func (s *Segmenter) SegmentMP4(
	ctx context.Context,
	mF *mp4ff.File,
) (map[uint32]*mp4ff.TrakBox, uint32, uint64, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL