fmp4

package
v1.0.6 Latest Latest
Warning

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

Go to latest
Published: Sep 15, 2021 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) MovieHeader

func (f *MovieFragmenter) MovieHeader() (filename, contentType string, blob []byte)

MovieHeader marshals an init.mp4 for the fragmenter's tracks

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

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) MovieHeader

func (f *TrackFragmenter) MovieHeader() (filename, contentType string, blob []byte)

MovieHeader 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) 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