codec

package
v0.24.0-rc1 Latest Latest
Warning

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

Go to latest
Published: Mar 29, 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 golog.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 golog.Logger) (VideoEncoder, error)
	MIMEType() string
}

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

Directories

Path Synopsis
Package h264 uses a V4L2-compatible h.264 hardware encoder (h264_v4l2m2m) to encode images.
Package h264 uses a V4L2-compatible h.264 hardware encoder (h264_v4l2m2m) to encode images.
Package opus contains the opus video codec.
Package opus contains the opus video codec.
Package vpx contains the vpx video codec.
Package vpx contains the vpx 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