fmp4

package
v1.6.0 Latest Latest
Warning

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

Go to latest
Published: Dec 10, 2023 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FragmentHeader

func FragmentHeader() []byte

FragmentHeader returns the header needed for the beginning of a MP4 segment file

func MovieHeader

func MovieHeader(tracks []*fmp4io.Track) ([]byte, error)

MovieHeader marshals an init.mp4 for the given tracks

Types

type MovieFragmenter

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

MovieFragmenter breaks a stream into segments each containing both tracks from the original stream

func NewMovie

func NewMovie(streams []av.CodecData) (*MovieFragmenter, error)

NewMovie creates a movie fragmenter from a stream

func (*MovieFragmenter) Duration

func (f *MovieFragmenter) Duration() time.Duration

Duration calculates the elapsed duration between the first and last pending video frame

func (*MovieFragmenter) Fragment

func (f *MovieFragmenter) Fragment() (fragment.Fragment, error)

Fragment produces a fragment out of the currently-queued packets.

func (*MovieFragmenter) Header added in v1.3.1

func (f *MovieFragmenter) Header() fragment.Header

Header marshals an init.mp4 for this track

func (*MovieFragmenter) NewSegment

func (f *MovieFragmenter) NewSegment()

NewSegment indicates that a new segment has begun and the next call to Fragment() should include a leading FTYP header

func (*MovieFragmenter) TimeScale added in v1.3.0

func (f *MovieFragmenter) TimeScale() uint32

func (*MovieFragmenter) WritePacket

func (f *MovieFragmenter) WritePacket(pkt av.Packet) error

WritePacket formats and queues a packet for the next fragment to be written

type TrackFragmenter

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

TrackFragmenter writes a single audio or video stream as a series of CMAF (fMP4) fragments

func NewTrack

func NewTrack(codecData av.CodecData) (*TrackFragmenter, error)

NewTrack creates a fragmenter from the given stream codec

func (*TrackFragmenter) Duration

func (f *TrackFragmenter) Duration() time.Duration

Duration calculates the elapsed duration between the first and last pending packet in the fragmenter

func (*TrackFragmenter) Fragment

func (f *TrackFragmenter) Fragment() (fragment.Fragment, error)

Fragment produces a fragment out of the currently-queued packets.

func (*TrackFragmenter) Header added in v1.3.1

func (f *TrackFragmenter) Header() fragment.Header

Header marshals an init.mp4 for this track

func (*TrackFragmenter) NewSegment

func (f *TrackFragmenter) NewSegment()

NewSegment indicates that a new segment has begun and the next call to Fragment() should include a leading FTYP header.

func (TrackFragmenter) SegmentExtension added in v1.3.1

func (TrackFragmenter) SegmentExtension() string

func (*TrackFragmenter) TimeScale

func (f *TrackFragmenter) TimeScale() uint32

TimeScale returns the number of timestamp ticks (DTS) that elapse in 1 second for this track

func (*TrackFragmenter) Track

func (f *TrackFragmenter) Track() (*fmp4io.Track, error)

Track creates a TRAK atom for this stream

func (*TrackFragmenter) WritePacket

func (f *TrackFragmenter) WritePacket(pkt av.Packet) error

WritePacket appends a packet to the fragmenter

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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