fmp4

package
v1.5.0 Latest Latest
Warning

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

Go to latest
Published: Oct 14, 2023 License: MIT Imports: 8 Imported by: 17

Documentation

Overview

Package fmp4 contains a fMP4 reader and writer.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BoxTypeIpcm added in v1.5.0

func BoxTypeIpcm() gomp4.BoxType

func BoxTypePcmC added in v1.5.0

func BoxTypePcmC() gomp4.BoxType

Types

type Codec

type Codec interface {
	IsVideo() bool
	// contains filtered or unexported methods
}

Codec is a fMP4 codec.

type CodecAC3 added in v1.4.0

type CodecAC3 struct {
	SampleRate   int
	ChannelCount int
	Fscod        uint8
	Bsid         uint8
	Bsmod        uint8
	Acmod        uint8
	LfeOn        bool
	BitRateCode  uint8
}

CodecAC3 is the AC-3 codec.

func (CodecAC3) IsVideo added in v1.4.0

func (CodecAC3) IsVideo() bool

IsVideo implements Codec.

type CodecAV1

type CodecAV1 struct {
	SequenceHeader []byte
}

CodecAV1 is the AV1 codec.

func (CodecAV1) IsVideo

func (CodecAV1) IsVideo() bool

IsVideo implements Codec.

type CodecH264

type CodecH264 struct {
	SPS []byte
	PPS []byte
}

CodecH264 is the H264 codec.

func (CodecH264) IsVideo

func (CodecH264) IsVideo() bool

IsVideo implements Codec.

type CodecH265

type CodecH265 struct {
	SPS []byte
	PPS []byte
	VPS []byte
}

CodecH265 is the H265 codec.

func (CodecH265) IsVideo

func (CodecH265) IsVideo() bool

IsVideo implements Codec.

type CodecLPCM added in v1.5.0

type CodecLPCM struct {
	LittleEndian bool
	BitDepth     int
	SampleRate   int
	ChannelCount int
}

CodecLPCM is the LPCM codec.

func (CodecLPCM) IsVideo added in v1.5.0

func (CodecLPCM) IsVideo() bool

IsVideo implements Codec.

type CodecMJPEG added in v1.4.0

type CodecMJPEG struct {
	Width  int
	Height int
}

CodecMJPEG is the M-JPEG codec.

func (CodecMJPEG) IsVideo added in v1.4.0

func (CodecMJPEG) IsVideo() bool

IsVideo implements Codec.

type CodecMPEG1Audio added in v1.3.0

type CodecMPEG1Audio struct {
	SampleRate   int
	ChannelCount int
}

CodecMPEG1Audio is a MPEG-1 Audio codec.

func (CodecMPEG1Audio) IsVideo added in v1.3.0

func (CodecMPEG1Audio) IsVideo() bool

IsVideo implements Codec.

type CodecMPEG1Video added in v1.3.0

type CodecMPEG1Video struct {
	Config []byte
}

CodecMPEG1Video is a MPEG-1 Video codec.

func (CodecMPEG1Video) IsVideo added in v1.3.0

func (CodecMPEG1Video) IsVideo() bool

IsVideo implements Codec.

type CodecMPEG4Audio

type CodecMPEG4Audio struct {
	mpeg4audio.Config
}

CodecMPEG4Audio is a MPEG-4 Audio codec.

func (CodecMPEG4Audio) IsVideo

func (CodecMPEG4Audio) IsVideo() bool

IsVideo implements Codec.

type CodecMPEG4Video added in v1.3.0

type CodecMPEG4Video struct {
	Config []byte
}

CodecMPEG4Video is a MPEG-4 Video codec.

func (CodecMPEG4Video) IsVideo added in v1.3.0

func (CodecMPEG4Video) IsVideo() bool

IsVideo implements Codec.

type CodecOpus

type CodecOpus struct {
	ChannelCount int
}

CodecOpus is the Opus codec.

func (CodecOpus) IsVideo

func (CodecOpus) IsVideo() bool

IsVideo implements Codec.

type CodecVP9

type CodecVP9 struct {
	Width             int
	Height            int
	Profile           uint8
	BitDepth          uint8
	ChromaSubsampling uint8
	ColorRange        bool
}

CodecVP9 is the VP9 codec.

func (CodecVP9) IsVideo

func (CodecVP9) IsVideo() bool

IsVideo implements Codec.

type Init

type Init struct {
	Tracks []*InitTrack
}

Init is a fMP4 initialization block.

func (*Init) Marshal

func (i *Init) Marshal(w io.WriteSeeker) error

Marshal encodes a fMP4 initialization file.

func (*Init) Unmarshal

func (i *Init) Unmarshal(byts []byte) error

Unmarshal decodes a fMP4 initialization block.

type InitTrack

type InitTrack struct {
	ID        int
	TimeScale uint32
	Codec     Codec
}

InitTrack is a track of Init.

type Part

type Part struct {
	SequenceNumber uint32
	Tracks         []*PartTrack
}

Part is a fMP4 part.

func (*Part) Marshal

func (p *Part) Marshal(w io.WriteSeeker) error

Marshal encodes a fMP4 part.

type PartSample

type PartSample struct {
	Duration        uint32
	PTSOffset       int32
	IsNonSyncSample bool
	Payload         []byte
}

PartSample is a sample of a PartTrack.

func NewPartSampleAV1

func NewPartSampleAV1(sequenceHeaderPresent bool, tu [][]byte) (*PartSample, error)

NewPartSampleAV1 creates a sample with AV1 data.

func NewPartSampleH26x

func NewPartSampleH26x(ptsOffset int32, randomAccessPresent bool, au [][]byte) (*PartSample, error)

NewPartSampleH26x creates a sample with H26x data.

func (PartSample) GetAV1

func (ps PartSample) GetAV1() ([][]byte, error)

GetAV1 gets AV1 data from the sample.

func (PartSample) GetH26x

func (ps PartSample) GetH26x() ([][]byte, error)

GetH26x gets H26x data from the sample.

type PartTrack

type PartTrack struct {
	ID       int
	BaseTime uint64
	Samples  []*PartSample
}

PartTrack is a track of Part.

type Parts

type Parts []*Part

Parts is a sequence of fMP4 parts.

func (*Parts) Marshal added in v1.5.0

func (ps *Parts) Marshal(w io.WriteSeeker) error

Marshal encodes a one or more fMP4 part.

func (*Parts) Unmarshal

func (ps *Parts) Unmarshal(byts []byte) error

Unmarshal decodes one or more fMP4 parts.

type PcmC added in v1.5.0

type PcmC struct {
	gomp4.FullBox `mp4:"0,extend"`
	FormatFlags   uint8 `mp4:"1,size=8"`
	PCMSampleSize uint8 `mp4:"1,size=8"`
}

func (PcmC) GetType added in v1.5.0

func (PcmC) GetType() gomp4.BoxType

Jump to

Keyboard shortcuts

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