ffmpeg

package
v0.0.0-...-837e36f Latest Latest
Warning

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

Go to latest
Published: Dec 9, 2024 License: MIT Imports: 7 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 FreeVideoFrame

func FreeVideoFrame(self *VideoFrame)

func HasDecoder

func HasDecoder(name string) bool

func HasEncoder

func HasEncoder(name string) bool

func NewVideoDecoder

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

func PixelFormatAV2FF

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

func PixelFormatFF2AV

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

func SetLogLevel

func SetLogLevel(level int)

Types

type FramerateConverter

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

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

func (self *FramerateConverter) Close()

Close frees the allocated filter graph

func (*FramerateConverter) ConfigureVideoFilters

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

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

func (*FramerateConverter) ConvertFramerate

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

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

CreateFilter fills filterPtr according to the given filterType

type VideoDecoder

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

func (*VideoDecoder) Close

func (dec *VideoDecoder) Close()

func (*VideoDecoder) Decode

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

func (*VideoDecoder) DecodeSingle

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

func (*VideoDecoder) Setup

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

type VideoEncoder

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

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

func NewVideoEncoderByName

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

func (*VideoEncoder) Close

func (enc *VideoEncoder) Close()

func (*VideoEncoder) CodecData

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

CodecData returns the video codec data of the encoder

func (*VideoEncoder) Encode

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

func (*VideoEncoder) GetGopSize

func (enc *VideoEncoder) GetGopSize() int

func (*VideoEncoder) GetOption

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

func (*VideoEncoder) SetBitrate

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

func (*VideoEncoder) SetFramerate

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

func (*VideoEncoder) SetGopSize

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

func (*VideoEncoder) SetOption

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

func (*VideoEncoder) SetPixelFormat

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

func (*VideoEncoder) SetResolution

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

func (*VideoEncoder) Setup

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

Setup initializes the encoder context and checks user params

type VideoFrame

type VideoFrame struct {
	Image image.YCbCr
	// contains filtered or unexported fields
}

func (*VideoFrame) Free

func (self *VideoFrame) Free()

func (VideoFrame) GetDataPtr

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

func (VideoFrame) GetPictureType

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

GetPictureType returns the encoded picture type

func (VideoFrame) GetPixelFormat

func (v VideoFrame) GetPixelFormat() av.PixelFormat

func (VideoFrame) GetResolution

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

func (VideoFrame) GetScanningMode

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

func (VideoFrame) GetStride

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

func (VideoFrame) Height

func (v VideoFrame) Height() int

func (*VideoFrame) SetPixelFormat

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

func (*VideoFrame) SetResolution

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

func (*VideoFrame) SetStride

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

func (VideoFrame) Width

func (v VideoFrame) Width() int

type VideoFramerate

type VideoFramerate struct {
	Num int
	Den int
}

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

type VideoScaler

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

func (*VideoScaler) Close

func (self *VideoScaler) Close()

func (*VideoScaler) FreeOutputImage

func (self *VideoScaler) FreeOutputImage()

func (*VideoScaler) VideoScale

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