formats

package
v0.10.7 Latest Latest
Warning

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

Go to latest
Published: Jun 8, 2021 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TypeHLS   = "hls"
	TypeDASH  = "dash"
	TypeRange = "range"

	FPS30 = 30
	FPS60 = 60
)

Variables

View Source
var (
	UHD4K  = Resolution{Height: 2160}
	QHD2K  = Resolution{Height: 1440}
	HD1080 = Resolution{Height: 1080}
	HD720  = Resolution{Height: 720}
	SD480  = Resolution{Height: 480}
	SD360  = Resolution{Height: 360}
	SD240  = Resolution{Height: 240}
)

Commonly defined resolutions

View Source
var H264 = Codec{
	Format{UHD4K, Bitrate{FPS30: 18000, FPS60: 28000}},
	Format{QHD2K, Bitrate{FPS30: 10000, FPS60: 16000}},
	Format{HD1080, Bitrate{FPS30: 2000, FPS60: 3200}},
	Format{HD720, Bitrate{FPS30: 1200, FPS60: 2000}},

	Format{SD360, Bitrate{FPS30: 400, FPS60: 640}},
}

H264 codec with its suggested bitrates

View Source
var Resolutions = []Resolution{
	UHD4K, QHD2K, HD1080, HD720, SD480, SD360, SD240,
}

Functions

func DetectFPS

func DetectFPS(meta *ffmpeg.Metadata) (int, error)

func GetVideoStream added in v0.4.3

func GetVideoStream(meta *ffmpeg.Metadata) transcoder.Streams

func SetLogger

func SetLogger(l *zap.SugaredLogger)

Types

type Bitrate

type Bitrate struct {
	FPS30, FPS60 int
}

Bitrate in kilobits

type Codec

type Codec []Format

func (Codec) CustomFormat added in v0.4.2

func (c Codec) CustomFormat(r Resolution) Format

CustomFormat generates a Format for non-standard resolutions, calculating optimal bitrates (note: it should be calculated better).

type Format

type Format struct {
	Resolution Resolution
	Bitrate    Bitrate
}

func TargetFormats

func TargetFormats(codec Codec, meta *ffmpeg.Metadata) ([]Format, error)

func (Format) GetBitrateForFPS

func (f Format) GetBitrateForFPS(fps int) int

type Resolution

type Resolution struct {
	Width, Height int
}

Jump to

Keyboard shortcuts

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