segmenter

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Nov 27, 2023 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrSegmenter = errors.New("SegmenterError")
View Source
var ErrSegmenterTimeout = errors.New("SegmenterTimeout")
View Source
var PlaylistRetryCount = 5
View Source
var PlaylistRetryWait = 500 * time.Millisecond

Functions

This section is empty.

Types

type FFMpegVideoSegmenter

type FFMpegVideoSegmenter struct {
	WorkDir      string
	LocalRtmpUrl string
	StrmID       string

	SegLen time.Duration
	// contains filtered or unexported fields
}

FFMpegVideoSegmenter segments a RTMP stream by invoking FFMpeg and monitoring the file system.

func NewFFMpegVideoSegmenter

func NewFFMpegVideoSegmenter(workDir string, strmID string, localRtmpUrl string, opt SegmenterOptions) *FFMpegVideoSegmenter

func (*FFMpegVideoSegmenter) Cleanup

func (s *FFMpegVideoSegmenter) Cleanup()

func (*FFMpegVideoSegmenter) PollPlaylist

func (s *FFMpegVideoSegmenter) PollPlaylist(ctx context.Context) (*VideoPlaylist, error)

PollPlaylist monitors the filesystem and returns a new playlist as it becomes available

func (*FFMpegVideoSegmenter) PollSegment

func (s *FFMpegVideoSegmenter) PollSegment(ctx context.Context) (*VideoSegment, error)

PollSegment monitors the filesystem and returns a new segment as it becomes available

func (*FFMpegVideoSegmenter) RTMPToHLS

func (s *FFMpegVideoSegmenter) RTMPToHLS(ctx context.Context, cleanup bool) error

RTMPToHLS invokes FFMpeg to do the segmenting. This method blocks until the segmenter exits.

type SegmenterOptions

type SegmenterOptions struct {
	EnforceKeyframe bool //Enforce each segment starts with a keyframe
	SegLength       time.Duration
	StartSeq        int
}

type VideoPlaylist

type VideoPlaylist struct {
	Format stream.VideoFormat
	// Data   []byte
	Data *m3u8.MediaPlaylist
}

type VideoSegment

type VideoSegment struct {
	Codec  av.CodecType
	Format stream.VideoFormat
	Length time.Duration
	Data   []byte
	Name   string
	SeqNo  uint64
}

type VideoSegmenter

type VideoSegmenter interface {
	RTMPToHLS(ctx context.Context, cleanup bool) error
}

Jump to

Keyboard shortcuts

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