Versions in this module Expand all Collapse all v0 v0.0.2 Aug 24, 2023 v0.0.1 Aug 23, 2023 Changes in this version + const BasicBoxLen + const FullBoxLen + const MOV_FRAG_SAMPLE_FLAG_DEGRADATION_PRIORITY_MASK + const MOV_FRAG_SAMPLE_FLAG_DEPENDED_MASK + const MOV_FRAG_SAMPLE_FLAG_DEPENDS_MASK + const MOV_FRAG_SAMPLE_FLAG_DEPENDS_NO + const MOV_FRAG_SAMPLE_FLAG_DEPENDS_YES + const MOV_FRAG_SAMPLE_FLAG_IS_NON_SYNC + const MOV_FRAG_SAMPLE_FLAG_PADDING_MASK + const MOV_FRAG_SAMPLE_FLAG_REDUNDANCY_MASK + const TF_FLAG_BASE_DATA_OFFSET + const TF_FLAG_DEAAULT_BASE_IS_MOOF + const TF_FLAG_DEAAULT_SAMPLE_FLAGS_PRESENT + const TF_FLAG_DEFAULT_SAMPLE_DURATION_PRESENT + const TF_FLAG_DEFAULT_SAMPLE_SIZE_PRESENT + const TF_FLAG_DURATION_IS_EMPTY + const TF_FLAG_SAMPLE_DESCRIPTION_INDEX_PRESENT + const TR_FLAG_DATA_FIRST_SAMPLE_FLAGS + const TR_FLAG_DATA_OFFSET + const TR_FLAG_DATA_SAMPLE_COMPOSITION_TIME + const TR_FLAG_DATA_SAMPLE_DURATION + const TR_FLAG_DATA_SAMPLE_FLAGS + const TR_FLAG_DATA_SAMPLE_SIZE + const UseSubsampleEncryption + type AVPacket struct + Cid MP4_CODEC_TYPE + Data []byte + Dts uint64 + Pts uint64 + TrackId int + type AudioSampleEntry struct + func NewAudioSampleEntry(format [4]byte) *AudioSampleEntry + func (entry *AudioSampleEntry) Decode(r io.Reader) (offset int, err error) + func (entry *AudioSampleEntry) Encode() (int, []byte) + func (entry *AudioSampleEntry) Size() uint64 + type BaseDescriptor struct + func (base *BaseDescriptor) Decode(data []byte) *codec.BitStream + func (base *BaseDescriptor) Encode() []byte + type BasicBox struct + Size uint64 + Type [4]byte + UserType [16]byte + func NewBasicBox(boxtype [4]byte) *BasicBox + func (box *BasicBox) Decode(r io.Reader) (int, error) + func (box *BasicBox) Encode() (int, []byte) + type BoxDecoder interface + Decode func(buf []byte) (int, error) + type BoxEncoder interface + Encode func(buf []byte) (int, []byte) + type BoxSize interface + Size func() uint64 + type ChunkLargeOffsetBox struct + func NewChunkLargeOffsetBox() *ChunkLargeOffsetBox + func (co64 *ChunkLargeOffsetBox) Decode(r io.Reader) (offset int, err error) + func (co64 *ChunkLargeOffsetBox) Encode() (int, []byte) + func (co64 *ChunkLargeOffsetBox) Size() uint64 + type ChunkOffsetBox struct + func NewChunkOffsetBox() *ChunkOffsetBox + func (stco *ChunkOffsetBox) Decode(r io.Reader) (offset int, err error) + func (stco *ChunkOffsetBox) Encode() (int, []byte) + func (stco *ChunkOffsetBox) Size() uint64 + type CompositionOffsetBox struct + func NewCompositionOffsetBox() *CompositionOffsetBox + func (ctts *CompositionOffsetBox) Decode(r io.Reader) (offset int, err error) + func (ctts *CompositionOffsetBox) Encode() (int, []byte) + func (ctts *CompositionOffsetBox) Size() uint64 + type EditListBox struct + func NewEditListBox(version uint32) *EditListBox + func (elst *EditListBox) Decode(r io.Reader) (offset int, err error) + func (elst *EditListBox) Encode() (int, []byte) + type FileTypeBox struct + Box *BasicBox + Compatible_brands []uint32 + Major_brand uint32 + Minor_version uint32 + func NewFileTypeBox() *FileTypeBox + func NewSegmentTypeBox() *FileTypeBox + func (ftyp *FileTypeBox) Encode() (int, []byte) + func (ftyp *FileTypeBox) Size() uint64 + type FreeBox struct + Box BasicBox + Data []byte + func NewFreeBox() *FreeBox + func (free *FreeBox) Decode(r io.Reader) (int, error) + func (free *FreeBox) Encode() (int, []byte) + func (free *FreeBox) Size() uint64 + type FullBox struct + Box *BasicBox + Flags [3]byte + Version uint8 + func NewFullBox(boxtype [4]byte, version uint8) *FullBox + func (box *FullBox) Decode(r io.Reader) (int, error) + func (box *FullBox) Encode() (int, []byte) + func (box *FullBox) Size() uint64 + type HandlerBox struct + Box *FullBox + Handler_type HandlerType + Name string + func NewHandlerBox(handlerType HandlerType, name string) *HandlerBox + func (hdlr *HandlerBox) Decode(r io.Reader, size uint64) (offset int, err error) + func (hdlr *HandlerBox) Encode() (int, []byte) + func (hdlr *HandlerBox) Size() uint64 + type HandlerType [4]byte + type HintMediaHeaderBox struct + AvgPDUsize uint16 + Avgbitrate uint32 + Box *FullBox + MaxPDUsize uint16 + Maxbitrate uint32 + func NewHintMediaHeaderBox() *HintMediaHeaderBox + func (hmhd *HintMediaHeaderBox) Decode(r io.Reader) (offset int, err error) + func (hmhd *HintMediaHeaderBox) Encode() (int, []byte) + func (hmhd *HintMediaHeaderBox) Size() uint64 + type HintSampleEntry struct + Data byte + Entry *SampleEntry + type MP4_CODEC_TYPE int + const MP4_CODEC_AAC + const MP4_CODEC_G711A + const MP4_CODEC_G711U + const MP4_CODEC_H264 + const MP4_CODEC_H265 + const MP4_CODEC_MP2 + const MP4_CODEC_MP3 + type MP4_FLAG uint32 + const MP4_FLAG_CUSTOM + const MP4_FLAG_DASH + const MP4_FLAG_FRAGMENT + const MP4_FLAG_KEYFRAME + type MediaHeaderBox struct + Box *FullBox + Creation_time uint64 + Duration uint64 + Language [3]uint8 + Modification_time uint64 + Pad uint8 + Pre_defined uint16 + Timescale uint32 + func NewMediaHeaderBox() *MediaHeaderBox + func (mdhd *MediaHeaderBox) Decode(r io.Reader) (offset int, err error) + func (mdhd *MediaHeaderBox) Encode() (int, []byte) + func (mdhd *MediaHeaderBox) Size() uint64 + type MovDemuxer struct + OnRawSample func(cid MP4_CODEC_TYPE, sample []byte, subSample *SubSample) error + func CreateMp4Demuxer(r io.ReadSeeker) *MovDemuxer + func (demuxer *MovDemuxer) GetMp4Info() Mp4Info + func (demuxer *MovDemuxer) GetSyncTable(trackId uint32) ([]SyncSample, error) + func (demuxer *MovDemuxer) ReadHead() ([]TrackInfo, error) + func (demuxer *MovDemuxer) ReadPacket() (*AVPacket, error) + func (demuxer *MovDemuxer) SeekTime(dts uint64) error + type MovieFragmentHeaderBox struct + Box *FullBox + SequenceNumber uint32 + func NewMovieFragmentHeaderBox(sequence uint32) *MovieFragmentHeaderBox + func (mfhd *MovieFragmentHeaderBox) Decode(r io.Reader) (offset int, err error) + func (mfhd *MovieFragmentHeaderBox) Encode() (int, []byte) + func (mfhd *MovieFragmentHeaderBox) Size() uint64 + type MovieFragmentRandomAccessOffsetBox struct + Box *FullBox + SizeOfMfra uint32 + func NewMovieFragmentRandomAccessOffsetBox(size uint32) *MovieFragmentRandomAccessOffsetBox + func (mfro *MovieFragmentRandomAccessOffsetBox) Decode(r io.Reader) (offset int, err error) + func (mfro *MovieFragmentRandomAccessOffsetBox) Encode() (int, []byte) + func (mfro *MovieFragmentRandomAccessOffsetBox) Size() uint64 + type MovieHeaderBox struct + Box *FullBox + Creation_time uint64 + Duration uint64 + Matrix [9]uint32 + Modification_time uint64 + Next_track_ID uint32 + Pre_defined [6]uint32 + Rate uint32 + Timescale uint32 + Volume uint16 + func NewMovieHeaderBox() *MovieHeaderBox + func (mvhd *MovieHeaderBox) Decode(r io.Reader) (offset int, err error) + func (mvhd *MovieHeaderBox) Encode() (int, []byte) + func (mvhd *MovieHeaderBox) Size() uint64 + type Movmuxer struct + func CreateMp4Muxer(w io.WriteSeeker, options ...MuxerOption) (*Movmuxer, error) + func (muxer *Movmuxer) AddAudioTrack(cid MP4_CODEC_TYPE, options ...TrackOption) uint32 + func (muxer *Movmuxer) AddVideoTrack(cid MP4_CODEC_TYPE, options ...TrackOption) uint32 + func (muxer *Movmuxer) FlushFragment() (err error) + func (muxer *Movmuxer) OnNewFragment(onFragment OnFragment) + func (muxer *Movmuxer) ReBindWriter(w io.WriteSeeker) + func (muxer *Movmuxer) Write(track uint32, data []byte, pts uint64, dts uint64) error + func (muxer *Movmuxer) WriteInitSegment(w io.Writer) error + func (muxer *Movmuxer) WriteTrailer() (err error) + type Mp4Info struct + CompatibleBrands []uint32 + CreateTime uint64 + Duration uint32 + MajorBrand uint32 + MinorVersion uint32 + ModifyTime uint64 + Timescale uint32 + type MuxerOption func(muxer *Movmuxer) + func WithMp4Flag(f MP4_FLAG) MuxerOption + type OnFragment func(duration uint32, firstPts, firstDts uint64) + type SampleDescriptionBox struct + func NewSampleDescriptionBox() *SampleDescriptionBox + func (entry *SampleDescriptionBox) Encode() (int, []byte) + func (stsd *SampleDescriptionBox) Decode(r io.Reader) (offset int, err error) + func (stsd *SampleDescriptionBox) Size() uint64 + type SampleEntry struct + func NewSampleEntry(format [4]byte) *SampleEntry + func (entry *SampleEntry) Decode(r io.Reader) (offset int, err error) + func (entry *SampleEntry) Encode() (int, []byte) + func (entry *SampleEntry) Size() uint64 + type SampleEntryType uint8 + const SAMPLE_AUDIO + const SAMPLE_VIDEO + type SampleSizeBox struct + func NewSampleSizeBox() *SampleSizeBox + func (stsz *SampleSizeBox) Decode(r io.Reader) (offset int, err error) + func (stsz *SampleSizeBox) Encode() (int, []byte) + func (stsz *SampleSizeBox) Size() uint64 + type SampleToChunkBox struct + func NewSampleToChunkBox() *SampleToChunkBox + func (stsc *SampleToChunkBox) Decode(r io.Reader) (offset int, err error) + func (stsc *SampleToChunkBox) Encode() (int, []byte) + func (stsc *SampleToChunkBox) Size() uint64 + type SegmentIndexBox struct + Box *FullBox + EarliestPresentationTime uint64 + Entrys []sidxEntry + FirstOffset uint64 + ReferenceCount uint16 + ReferenceID uint32 + TimeScale uint32 + func NewSegmentIndexBox() *SegmentIndexBox + func (sidx *SegmentIndexBox) Decode(r io.Reader) (offset int, err error) + func (sidx *SegmentIndexBox) Encode() (int, []byte) + func (sidx *SegmentIndexBox) Size() uint64 + type SencBox struct + Box *FullBox + EntryList *movsenc + PerSampleIVSize uint32 + SampleCount uint32 + func (senc *SencBox) Decode(r io.Reader, size uint32, perSampleIVSize uint8) (offset int, err error) + type SoundMediaHeaderBox struct + Balance int16 + Box *FullBox + func NewSoundMediaHeaderBox() *SoundMediaHeaderBox + func (smhd *SoundMediaHeaderBox) Decode(r io.Reader) (offset int, err error) + func (smhd *SoundMediaHeaderBox) Encode() (int, []byte) + func (smhd *SoundMediaHeaderBox) Size() uint64 + type SubSample struct + IV [16]byte + Number uint32 + Patterns []SubSamplePattern + type SubSamplePattern struct + BytesClear uint16 + BytesProtected uint32 + type SyncSample struct + Dts uint64 + Offset uint32 + Pts uint64 + Size uint32 + type SyncSampleBox struct + func NewSyncSampleBox() *SyncSampleBox + func (stss *SyncSampleBox) Decode(r io.Reader) (offset int, err error) + func (stss *SyncSampleBox) Encode() (int, []byte) + func (stss *SyncSampleBox) Size() uint64 + type TimeToSampleBox struct + func NewTimeToSampleBox() *TimeToSampleBox + func (stts *TimeToSampleBox) Decode(r io.Reader) (offset int, err error) + func (stts *TimeToSampleBox) Encode() (int, []byte) + func (stts *TimeToSampleBox) Size() uint64 + type TrackExtendsBox struct + Box *FullBox + DefaultSampleDescriptionIndex uint32 + DefaultSampleDuration uint32 + DefaultSampleFlags uint32 + DefaultSampleSize uint32 + TrackID uint32 + func NewTrackExtendsBox(track uint32) *TrackExtendsBox + func (trex *TrackExtendsBox) Decode(r io.Reader) (offset int, err error) + func (trex *TrackExtendsBox) Encode() (int, []byte) + func (trex *TrackExtendsBox) Size() uint64 + type TrackFragmentBaseMediaDecodeTimeBox struct + BaseMediaDecodeTime uint64 + Box *FullBox + func NewTrackFragmentBaseMediaDecodeTimeBox(fragStart uint64) *TrackFragmentBaseMediaDecodeTimeBox + func (tfdt *TrackFragmentBaseMediaDecodeTimeBox) Decode(r io.Reader, size uint32) (offset int, err error) + func (tfdt *TrackFragmentBaseMediaDecodeTimeBox) Encode() (int, []byte) + func (tfdt *TrackFragmentBaseMediaDecodeTimeBox) Size() uint64 + type TrackFragmentHeaderBox struct + BaseDataOffset uint64 + Box *FullBox + DefaultSampleDuration uint32 + DefaultSampleFlags uint32 + DefaultSampleSize uint32 + SampleDescriptionIndex uint32 + Track_ID uint32 + func NewTrackFragmentHeaderBox(trackid uint32) *TrackFragmentHeaderBox + func (tfhd *TrackFragmentHeaderBox) Decode(r io.Reader, size uint32, moofOffset uint64) (offset int, err error) + func (tfhd *TrackFragmentHeaderBox) Encode() (int, []byte) + func (tfhd *TrackFragmentHeaderBox) Size() uint64 + type TrackFragmentRandomAccessBox struct + Box *FullBox + FragEntrys *movtfra + LengthSizeOfSampleNum uint8 + LengthSizeOfTrafNum uint8 + LengthSizeOfTrunNum uint8 + NumberOfEntry uint32 + TrackID uint32 + func NewTrackFragmentRandomAccessBox(trackid uint32) *TrackFragmentRandomAccessBox + func (tfra *TrackFragmentRandomAccessBox) Decode(r io.Reader) (offset int, err error) + func (tfra *TrackFragmentRandomAccessBox) Encode() (int, []byte) + func (tfra *TrackFragmentRandomAccessBox) Size() uint64 + type TrackHeaderBox struct + Alternate_group uint16 + Box *FullBox + Creation_time uint64 + Duration uint64 + Height uint32 + Layer uint16 + Matrix [9]uint32 + Modification_time uint64 + Track_ID uint32 + Volume uint16 + Width uint32 + func NewTrackHeaderBox() *TrackHeaderBox + func (tkhd *TrackHeaderBox) Decode(r io.Reader) (offset int, err error) + func (tkhd *TrackHeaderBox) Encode() (int, []byte) + func (tkhd *TrackHeaderBox) Size() uint64 + type TrackInfo struct + ChannelCount uint8 + Cid MP4_CODEC_TYPE + Duration uint32 + EndDts uint64 + Height uint32 + SampleRate uint32 + SampleSize uint16 + StartDts uint64 + Timescale uint32 + TrackId int + Width uint32 + type TrackOption func(track *mp4track) + func WithAudioChannelCount(channelCount uint8) TrackOption + func WithAudioSampleBits(sampleBits uint8) TrackOption + func WithAudioSampleRate(sampleRate uint32) TrackOption + func WithExtraData(extraData []byte) TrackOption + func WithVideoHeight(height uint32) TrackOption + func WithVideoWidth(width uint32) TrackOption + type TrackRunBox struct + Box *FullBox + Dataoffset int32 + EntryList *movtrun + FirstSampleFlags uint32 + SampleCount uint32 + func NewTrackRunBox() *TrackRunBox + func (trun *TrackRunBox) Decode(r io.Reader, size uint32, dataOffset uint32) (offset int, err error) + func (trun *TrackRunBox) Encode() (int, []byte) + func (trun *TrackRunBox) Size() uint64 + type VideoMediaHeaderBox struct + Box *FullBox + Graphicsmode uint16 + Opcolor [3]uint16 + func NewVideoMediaHeaderBox() *VideoMediaHeaderBox + func (vmhd *VideoMediaHeaderBox) Decode(r io.Reader) (offset int, err error) + func (vmhd *VideoMediaHeaderBox) Encode() (int, []byte) + func (vmhd *VideoMediaHeaderBox) Size() uint64 + type VisualSampleEntry struct + func NewVisualSampleEntry(format [4]byte) *VisualSampleEntry + func (entry *VisualSampleEntry) Decode(r io.Reader) (offset int, err error) + func (entry *VisualSampleEntry) Encode() (int, []byte) + func (entry *VisualSampleEntry) Size() uint64