nvenc

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Nov 27, 2026 License: Apache-2.0 Imports: 16 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package nvenc drives NVIDIA's hardware encoder through nvEncodeAPI64.dll's function table, with no cgo and no NVIDIA SDK at build time.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Adapters

func Adapters() ([]gpu.Adapter, error)

Adapters lists the CUDA devices NVENC can encode on. An adapter's LUID is its DRM render node's device number where the GPU has one, as pkg/gpu names Linux adapters; under WSL, where it has none, it is the CUDA ordinal plus one.

func MaxAPIVersion

func MaxAPIVersion() (major, minor uint32, err error)

MaxAPIVersion reports the NVENC API version the installed driver supports.

func Probe

func Probe(adapter gpu.Adapter) (encode.Caps, error)

Probe reports what NVENC offers on adapter's CUDA device.

Types

type Encoder

type Encoder struct {
	// contains filtered or unexported fields
}

func Open

func Open(adapter gpu.Adapter, cfg encode.Config, opts Options) (*Encoder, error)

Open starts an encoder on adapter's CUDA device. Encode takes Linux frames (capture.DMABuf surfaces) with their planes in memory, or in a linear DMA-BUF it maps, and uploads each to the GPU.

func (*Encoder) Caps

func (e *Encoder) Caps() encode.Caps

func (*Encoder) Close

func (e *Encoder) Close() error

func (*Encoder) Encode

func (e *Encoder) Encode(f capture.Frame, forceKey bool, dst []byte) (encode.Packet, error)

func (*Encoder) EncodeSlices

func (e *Encoder) EncodeSlices(f capture.Frame, forceKey bool, dst []byte, emit func(int, []byte, bool) error) (encode.Packet, error)

EncodeSlices emits slices as they finish when the encoder was opened with Config.SubFrame; otherwise it emits nothing and is Encode.

func (*Encoder) FirstSlice

func (e *Encoder) FirstSlice() time.Duration

FirstSlice is how long after submission the first slice of the last sub-frame encode became readable, and Submitted is when Encode submitted it.

func (*Encoder) InvalidateRefs

func (e *Encoder) InvalidateRefs(pts int64) error

InvalidateRefs stops the encoder predicting from the picture with this PTS and later ones, so the next picture references an older one that the receiver still holds.

func (*Encoder) SetBitrate

func (e *Encoder) SetBitrate(kbps int) error

type Error

type Error struct {
	Fn     int
	Status uint32
	Detail string
}

func (*Error) Error

func (e *Error) Error() string

type Options

type Options struct {
	// SplitMode, when not 0, is the NV_ENC_SPLIT_ENCODE_MODE to use
	// whatever Config.Split says: 2 forces two engines, 15 disables.
	SplitMode uint32
}

Options are NVENC specific knobs beyond encode.Config.

Jump to

Keyboard shortcuts

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