mp4

package
v1.8.5 Latest Latest
Warning

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

Go to latest
Published: Jan 1, 2024 License: MIT Imports: 14 Imported by: 2

README

Fragmented MP4

ffmpeg -i "rtsp://..." -movflags +frag_keyframe+separate_moof+default_base_moof+empty_moov -frag_duration 1 -c copy -t 5 sample.mp4
  • movflags frag_keyframe Start a new fragment at each video keyframe.
  • frag_duration duration Create fragments that are duration microseconds long.
  • movflags separate_moof Write a separate moof (movie fragment) atom for each track.
  • movflags default_base_moof Similarly to the omit_tfhd_offset, this flag avoids writing the absolute base_data_offset field in tfhd atoms, but does so by using the new default-base-is-moof flag instead.

https://ffmpeg.org/ffmpeg-formats.html#Options-13

HEVC

Browser avc1 hvc1 hev1
Mac Chrome + - +
Mac Safari + + -
iOS 15? + + -
Mac Firefox + - -
iOS 12 + - -
Android 13 + - -

Documentation

Index

Constants

View Source
const (
	MimeH264 = "avc1.640029"
	MimeH265 = "hvc1.1.6.L153.B0"
	MimeAAC  = "mp4a.40.2"
	MimeFlac = "flac"
	MimeOpus = "opus"
)

Variables

This section is empty.

Functions

func ContentType added in v1.7.0

func ContentType(codecs []*core.Codec) string

func MimeCodecs added in v1.7.0

func MimeCodecs(codecs []*core.Codec) string

func ParseCodecs added in v1.6.0

func ParseCodecs(codecs string, parseAudio bool) (medias []*core.Media)

func ParseQuery added in v1.1.0

func ParseQuery(query map[string][]string) []*core.Media

ParseQuery - like usual parse, but with mp4 param handler

func PatchVideoRotate added in v1.6.1

func PatchVideoRotate(init []byte, degrees int) bool

PatchVideoRotate - update video track transformation matrix. Rotation supported by many players and browsers (except Safari). Scale has low support and better not to use it. Supported only 0, 90, 180, 270 degrees.

func PatchVideoScale added in v1.6.1

func PatchVideoScale(init []byte, scaleX, scaleY int) bool

PatchVideoScale - update "Pixel Aspect Ratio" atom. Supported by many players and browsers (except Firefox). Supported only positive integers.

Types

type Consumer

type Consumer struct {
	core.SuperConsumer

	Rotate int `json:"-"`
	ScaleX int `json:"-"`
	ScaleY int `json:"-"`
	// contains filtered or unexported fields
}

func NewConsumer added in v1.7.0

func NewConsumer(medias []*core.Media) *Consumer

func (*Consumer) AddTrack

func (c *Consumer) AddTrack(media *core.Media, _ *core.Codec, track *core.Receiver) error

func (*Consumer) Stop added in v1.3.0

func (c *Consumer) Stop() error

func (*Consumer) WriteTo added in v1.7.0

func (c *Consumer) WriteTo(wr io.Writer) (int64, error)

type Keyframe added in v1.7.0

type Keyframe struct {
	core.SuperConsumer
	// contains filtered or unexported fields
}

func NewKeyframe added in v1.7.0

func NewKeyframe(medias []*core.Media) *Keyframe

func (*Keyframe) AddTrack added in v1.7.0

func (c *Keyframe) AddTrack(media *core.Media, _ *core.Codec, track *core.Receiver) error

func (*Keyframe) Stop added in v1.7.0

func (c *Keyframe) Stop() error

func (*Keyframe) WriteTo added in v1.7.0

func (c *Keyframe) WriteTo(wr io.Writer) (int64, error)

type Muxer

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

func (*Muxer) AddTrack added in v1.7.0

func (m *Muxer) AddTrack(codec *core.Codec)

func (*Muxer) GetInit

func (m *Muxer) GetInit() ([]byte, error)

func (*Muxer) GetPayload added in v1.7.0

func (m *Muxer) GetPayload(trackID byte, packet *rtp.Packet) []byte

func (*Muxer) Reset

func (m *Muxer) Reset()

Jump to

Keyboard shortcuts

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