ffmpeg

package
v1.0.31 Latest Latest
Warning

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

Go to latest
Published: Sep 3, 2023 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	QUIET   = int(C.AV_LOG_QUIET)
	PANIC   = int(C.AV_LOG_PANIC)
	FATAL   = int(C.AV_LOG_FATAL)
	ERROR   = int(C.AV_LOG_ERROR)
	WARNING = int(C.AV_LOG_WARNING)
	INFO    = int(C.AV_LOG_INFO)
	VERBOSE = int(C.AV_LOG_VERBOSE)
	DEBUG   = int(C.AV_LOG_DEBUG)
	TRACE   = int(C.AV_LOG_TRACE)
)

Variables

This section is empty.

Functions

func AudioCodecHandler

func AudioCodecHandler(h *avutil.RegisterHandler)

func HasDecoder

func HasDecoder(name string) bool

func HasEncoder

func HasEncoder(name string) bool

func PixelFormatAV2FF added in v1.0.14

func PixelFormatAV2FF(pixelFormat av.PixelFormat) (ffpixelfmt int32)

func PixelFormatFF2AV added in v1.0.14

func PixelFormatFF2AV(ffpixelfmt int32) (pixelFormat av.PixelFormat)

func SetLogLevel

func SetLogLevel(level int)

Types

type AudioDecoder

type AudioDecoder struct {
	ChannelLayout av.ChannelLayout
	SampleFormat  av.SampleFormat
	SampleRate    int
	Extradata     []byte
	// contains filtered or unexported fields
}

func NewAudioDecoder

func NewAudioDecoder(codec av.AudioCodecData) (dec *AudioDecoder, err error)

func (*AudioDecoder) Close

func (self *AudioDecoder) Close()

func (*AudioDecoder) Decode

func (self *AudioDecoder) Decode(pkt []byte) (gotframe bool, frame av.AudioFrame, err error)

func (*AudioDecoder) Setup

func (self *AudioDecoder) Setup() (err error)

type AudioEncoder

type AudioEncoder struct {
	SampleRate       int
	Bitrate          int
	ChannelLayout    av.ChannelLayout
	SampleFormat     av.SampleFormat
	FrameSampleCount int
	// contains filtered or unexported fields
}

func NewAudioEncoderByCodecType

func NewAudioEncoderByCodecType(typ av.CodecType) (enc *AudioEncoder, err error)

func NewAudioEncoderByName

func NewAudioEncoderByName(name string) (enc *AudioEncoder, err error)

func (*AudioEncoder) Close

func (self *AudioEncoder) Close()

func (*AudioEncoder) CodecData

func (self *AudioEncoder) CodecData() (codec av.AudioCodecData, err error)

func (*AudioEncoder) Encode

func (self *AudioEncoder) Encode(frame av.AudioFrame) (pkts [][]byte, err error)

func (*AudioEncoder) GetOption

func (self *AudioEncoder) GetOption(key string, val interface{}) (err error)

func (*AudioEncoder) SetBitrate

func (self *AudioEncoder) SetBitrate(bitrate int) (err error)

func (*AudioEncoder) SetChannelLayout

func (self *AudioEncoder) SetChannelLayout(ch av.ChannelLayout) (err error)

func (*AudioEncoder) SetOption

func (self *AudioEncoder) SetOption(key string, val interface{}) (err error)

func (*AudioEncoder) SetSampleFormat

func (self *AudioEncoder) SetSampleFormat(fmt av.SampleFormat) (err error)

func (*AudioEncoder) SetSampleRate

func (self *AudioEncoder) SetSampleRate(rate int) (err error)

func (*AudioEncoder) Setup

func (self *AudioEncoder) Setup() (err error)

type FramerateConverter added in v1.0.14

type FramerateConverter struct {
	OutPixelFormat av.PixelFormat
	OutWidth       int
	OutHeight      int
	OutFpsNum      int
	OutFpsDen      int
	// contains filtered or unexported fields
}

FramerateConverter allows increasing or decreasing the video framerate using libavfilter's processing filters

func (*FramerateConverter) AddFilter added in v1.0.14

func (self *FramerateConverter) AddFilter(prevFilter *C.AVFilterContext, nextFilter *C.AVFilterContext, name string, arg string) (err error)

AddFilter creates a filter and adds it in the filtergraph, between prevFilter and nextFilter

func (*FramerateConverter) Close added in v1.0.14

func (self *FramerateConverter) Close()

Close frees the allocated filter graph

func (*FramerateConverter) ConfigureVideoFilters added in v1.0.14

func (self *FramerateConverter) ConfigureVideoFilters() (err error)

ConfigureVideoFilters creates the filtergraph: BufferSrc => FpsConv => BufferSink

func (*FramerateConverter) ConvertFramerate added in v1.0.14

func (self *FramerateConverter) ConvertFramerate(in *VideoFrame) (out []*VideoFrame, err error)

ConvertFramerate pushes a frame in the filtergraph and receives 0, 1 or more frames with converted framerate

func (*FramerateConverter) CreateFilter added in v1.0.14

func (self *FramerateConverter) CreateFilter(filterPtr **C.AVFilterContext, filterType string, filterName string, filterArgs string) int

CreateFilter fills filterPtr according to the given filterType

type Resampler

type Resampler struct {
	OutSampleFormat  av.SampleFormat
	OutChannelLayout av.ChannelLayout
	OutSampleRate    int
	// contains filtered or unexported fields
}

func (*Resampler) Close

func (self *Resampler) Close()

func (*Resampler) Resample

func (self *Resampler) Resample(in av.AudioFrame) (out av.AudioFrame, err error)

type VideoDecoder

type VideoDecoder struct {
	Extradata []byte
	// contains filtered or unexported fields
}

func NewVideoDecoder

func NewVideoDecoder(stream av.CodecData) (dec *VideoDecoder, err error)

func (*VideoDecoder) Close added in v1.0.14

func (dec *VideoDecoder) Close()

func (*VideoDecoder) Decode

func (self *VideoDecoder) Decode(pkt []byte) (img *VideoFrame, err error)

func (VideoDecoder) GetFramerate added in v1.0.14

func (dec VideoDecoder) GetFramerate() (num, den int)

func (*VideoDecoder) SetFramerate added in v1.0.17

func (dec *VideoDecoder) SetFramerate(num, den int) (err error)

func (*VideoDecoder) Setup

func (self *VideoDecoder) Setup() (err error)

type VideoEncoder added in v1.0.14

type VideoEncoder struct {
	Bitrate int
	// contains filtered or unexported fields
}

VideoEncoder contains all params that must be set by user to initialize the video encoder

func NewVideoEncoderByCodecType added in v1.0.14

func NewVideoEncoderByCodecType(typ av.CodecType) (enc *VideoEncoder, err error)

func NewVideoEncoderByName added in v1.0.14

func NewVideoEncoderByName(name string) (enc *VideoEncoder, err error)

func (*VideoEncoder) Close added in v1.0.14

func (enc *VideoEncoder) Close()

func (*VideoEncoder) CodecData added in v1.0.14

func (enc *VideoEncoder) CodecData() (codec av.VideoCodecData, err error)

CodecData returns the video codec data of the encoder

func (*VideoEncoder) Encode added in v1.0.14

func (enc *VideoEncoder) Encode(img *VideoFrame) (pkts []av.Packet, err error)

func (*VideoEncoder) GetGopSize added in v1.0.17

func (enc *VideoEncoder) GetGopSize() int

func (*VideoEncoder) GetOption added in v1.0.14

func (enc *VideoEncoder) GetOption(key string, val interface{}) (err error)

func (*VideoEncoder) SetBitrate added in v1.0.14

func (enc *VideoEncoder) SetBitrate(bitrate int) (err error)

func (*VideoEncoder) SetFramerate added in v1.0.14

func (enc *VideoEncoder) SetFramerate(num, den int) (err error)

func (*VideoEncoder) SetGopSize added in v1.0.14

func (enc *VideoEncoder) SetGopSize(gopSize int) (err error)

func (*VideoEncoder) SetOption added in v1.0.14

func (enc *VideoEncoder) SetOption(key string, val interface{}) (err error)

func (*VideoEncoder) SetPixelFormat added in v1.0.14

func (enc *VideoEncoder) SetPixelFormat(fmt av.PixelFormat) (err error)

func (*VideoEncoder) SetResolution added in v1.0.14

func (enc *VideoEncoder) SetResolution(w, h int) (err error)

func (*VideoEncoder) Setup added in v1.0.14

func (enc *VideoEncoder) Setup() (err error)

Setup initializes the encoder context and checks user params

type VideoFrame

type VideoFrame struct {
	Image image.YCbCr

	Framerate VideoFramerate
	// contains filtered or unexported fields
}

func (*VideoFrame) Free

func (self *VideoFrame) Free()

func (VideoFrame) GetDataPtr added in v1.0.14

func (v VideoFrame) GetDataPtr() (y, cb, cr *[]uint8)

func (VideoFrame) GetFramerate added in v1.0.14

func (v VideoFrame) GetFramerate() (num, den int)

GetFramerate returns the framerate as a fraction (numerator and denominator)

func (VideoFrame) GetPictureType added in v1.0.14

func (v VideoFrame) GetPictureType() (picType h264parser.SliceType, err error)

GetPictureType returns the encoded picture type

func (VideoFrame) GetPixelFormat added in v1.0.14

func (v VideoFrame) GetPixelFormat() av.PixelFormat

func (VideoFrame) GetResolution added in v1.0.14

func (v VideoFrame) GetResolution() (w, h int)

func (VideoFrame) GetScanningMode added in v1.0.14

func (v VideoFrame) GetScanningMode() (mode av.ScanningMode)

func (VideoFrame) GetStride added in v1.0.14

func (v VideoFrame) GetStride() (yStride, cStride int)

func (VideoFrame) Height added in v1.0.14

func (v VideoFrame) Height() int

func (*VideoFrame) SetFramerate added in v1.0.14

func (v *VideoFrame) SetFramerate(num, den int)

SetFramerate sets the frame's FPS numerator and denominator

func (*VideoFrame) SetPixelFormat added in v1.0.14

func (v *VideoFrame) SetPixelFormat(format av.PixelFormat)

func (*VideoFrame) SetResolution added in v1.0.14

func (v *VideoFrame) SetResolution(w, h int)

func (*VideoFrame) SetStride added in v1.0.14

func (v *VideoFrame) SetStride(yStride, cStride int)

func (VideoFrame) Width added in v1.0.14

func (v VideoFrame) Width() int

type VideoFramerate added in v1.0.14

type VideoFramerate struct {
	Num int
	Den int
}

VideoFramerate represents a FPS value with a fraction (numerator + denominator)

type VideoScaler added in v1.0.14

type VideoScaler struct {
	OutPixelFormat av.PixelFormat
	OutWidth       int
	OutHeight      int
	OutYStride     int
	OutCStride     int
	// contains filtered or unexported fields
}

func (*VideoScaler) Close added in v1.0.14

func (self *VideoScaler) Close()

func (*VideoScaler) FreeOutputImage added in v1.0.14

func (self *VideoScaler) FreeOutputImage()

func (*VideoScaler) VideoScale added in v1.0.14

func (self *VideoScaler) VideoScale(src *VideoFrame) (dst *VideoFrame, err error)

Jump to

Keyboard shortcuts

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