codec

package
v0.41.0-rc0 Latest Latest
Warning

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

Go to latest
Published: Sep 9, 2024 License: AGPL-3.0 Imports: 5 Imported by: 0

Documentation

Overview

Package codec defines the encoder and factory interfaces for encoding video frames and audio chunks.

Index

Constants

View Source
const DefaultKeyFrameInterval = 30

DefaultKeyFrameInterval is the default interval chosen in order to produce high enough quality results at a low latency.

Variables

This section is empty.

Functions

This section is empty.

Types

type AudioEncoder

type AudioEncoder interface {
	Encode(ctx context.Context, chunk wave.Audio) ([]byte, bool, error)
	Close()
}

An AudioEncoder is anything that can encode audo chunks into bytes. This means that the encoder must follow some type of format dictated by a type (see AudioEncoderFactory.MimeType). An encoder that produces bytes of different encoding formats per call is invalid.

type AudioEncoderFactory

type AudioEncoderFactory interface {
	New(sampleRate, channelCount int, latency time.Duration, logger logging.Logger) (AudioEncoder, error)
	MIMEType() string
}

An AudioEncoderFactory produces AudioEncoders and provides information about the underlying encoder itself.

type VideoEncoder

type VideoEncoder interface {
	Encode(ctx context.Context, img image.Image) ([]byte, error)
	Close() error
}

A VideoEncoder is anything that can encode images into bytes. This means that the encoder must follow some type of format dictated by a type (see EncoderFactory.MimeType). An encoder that produces bytes of different encoding formats per call is invalid.

type VideoEncoderFactory

type VideoEncoderFactory interface {
	New(height, width, keyFrameInterval int, logger logging.Logger) (VideoEncoder, error)
	MIMEType() string
}

A VideoEncoderFactory produces VideoEncoders and provides information about the underlying encoder itself.

Directories

Path Synopsis
Package opus contains the opus video codec.
Package opus contains the opus video codec.
Package x264 contains the x264 video codec.
Package x264 contains the x264 video codec.

Jump to

Keyboard shortcuts

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