Documentation
¶
Overview ¶
Package encoder provides SVT-AV1 library-based encoding for chunked encoding.
Index ¶
- func EncodeChunkToIVF(ctx context.Context, cfg *EncConfig, readFrame func([]byte) error, ...) (err error)
- func MaxBitRateBps() uint32
- func PeakSecondBps(r io.Reader, fpsNum, fpsDen uint32) (float64, error)
- func SVTVersion() string
- func SvtParamsDisplay(acBias float32, enableVarianceBoost bool, tune uint8) string
- type EncConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func EncodeChunkToIVF ¶
func EncodeChunkToIVF(ctx context.Context, cfg *EncConfig, readFrame func([]byte) error, progressCb func(encoded int)) (err error)
EncodeChunkToIVF encodes a chunk of video frames to an IVF file using the SVT-AV1 library. readFrame is called for each frame to fill the provided buffer with 10-bit YUV420 data. progressCb is called periodically with the number of frames encoded so far.
func MaxBitRateBps ¶
func MaxBitRateBps() uint32
MaxBitRateBps returns the bitstream cap applied to every encode, for the target-quality search to reject probes whose encodes escaped it.
func PeakSecondBps ¶
PeakSecondBps returns the highest one-second bitrate in an IVF file, bucketing frame payloads by displayed second (frame pts is the frame index in EncodeChunkToIVF's output). Hardware decoders are provisioned for the signaled level's instantaneous rate, so the target-quality search gates probes on this rather than on the chunk average.
func SVTVersion ¶
func SVTVersion() string
SVTVersion returns the version string reported by the linked SVT-AV1 library.
Types ¶
type EncConfig ¶
type EncConfig struct {
Inf *video.Info // Video properties
CRF float32 // Quality (CRF value)
Preset uint8 // SVT-AV1 preset (0-13)
Tune uint8 // SVT-AV1 tune
Output string // Output IVF path
GrainTable *string // Optional film grain table path (not supported with library)
Width uint32 // Frame width (after cropping)
Height uint32 // Frame height (after cropping)
Frames int // Number of frames to encode
LevelOfParallelism uint32 // SVT-AV1 level_of_parallelism (1-6); 0 lets SVT choose
// Advanced SVT-AV1 parameters
ACBias float32
EnableVarianceBoost bool
VarianceBoostStrength uint8
VarianceOctile uint8
}
EncConfig contains configuration for encoding a chunk.