selfcheck

package
v0.0.0-...-d18ddae Latest Latest
Warning

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

Go to latest
Published: Dec 3, 2026 License: GPL-3.0 Imports: 15 Imported by: 1 module, 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 selfcheck proves a transcoder image can do its class's work: it loads FFmpeg 9 and the ffgo shim in-process (pkg/ffruntime), finds every encoder, muxer and filter the class needs by name, and encodes with the CPU encoders. CI runs it on every built image (`transcode --self-check=<class>`), so a missing library fails the build, not a job; Trial adds a real encode on the class's GPU.

Index

Constants

This section is empty.

Variables

View Source
var Needs = map[Class]Need{
	ClassCPU: {
		Encoders: []string{"libx265", "aac", "ac3"},
		Muxers:   []string{"mp4", "srt"},
	},
	ClassCUDA: {
		Encoders: []string{"libx265", "aac", "ac3", "hevc_nvenc"},
		Muxers:   []string{"mp4", "srt"},
		Filters:  []string{"scale_cuda", "hwupload"},
	},
	ClassIntel: {
		Encoders: []string{"libx265", "aac", "ac3", "hevc_qsv", "hevc_vaapi"},
		Muxers:   []string{"mp4", "srt"},
		Filters:  []string{"vpp_qsv", "scale_vaapi", "hwupload"},
	},
}

Needs is each class's encoders, muxers and filters. Since standard Version 2 every class encodes with ac3 a surround track that is not E-AC-3 or AC-3, and writes the MP4 and its SubRip and ASS sidecars through the mp4 and srt muxers (spec 2026-10-06 §7.4; no ass muxer since standard.Version 5).

View Source
var RuntimeLibs = map[Class][]RuntimeLib{
	ClassIntel: {
		{Name: "libva.so.2", Symbols: []string{"vaInitialize", "vaMapBuffer2"}},
		{Name: "libva-drm.so.2", Symbols: []string{"vaGetDisplayDRM"}},
		{Name: "$LIBVA_DRIVERS_PATH/iHD_drv_video.so"},
		{Name: "libmfx-gen.so.1.2"},
		{Name: "libmfxhw64.so.1"},
	},
}

RuntimeLibs is each class's run-time libraries. Intel's are what the transcoder image stages on amd64 for BtbN's libva stubs (which call libva 2.21's vaMapBuffer2: with Debian 12's libva 2.17 they abort the process), the iHD driver libva loads, and both QSV runtimes the libvpl dispatcher loads. NVIDIA's driver libraries are the container toolkit's to inject, so the CUDA class has none here; its trial opens the device.

Functions

func IntelRenderNode

func IntelRenderNode() string

IntelRenderNode is the first DRM render node whose PCI vendor is Intel (0x8086) and that this container has and can open, or "": a node with both an Intel iGPU and an NVIDIA card has two, and only Intel's takes VAAPI and QSV. /sys/class/drm is the host's even in a container, so a node the device plugin did not mount is passed over -- opening VAAPI on it falls back to X11, and BtbN's libX11 stub aborts the process.

Types

type Class

type Class string

Class is a transcoder image's hardware class.

const (
	ClassCPU   Class = "cpu"
	ClassCUDA  Class = "cuda"
	ClassIntel Class = "intel"
)

type Need

type Need struct {
	Encoders []string
	Muxers   []string
	Filters  []string
}

Need is what a class's image must have, by FFmpeg name.

type Report

type Report struct {
	FFmpegMajor int             `json:"ffmpegMajor"`
	ShimMatched bool            `json:"shimMatched"`
	ShimAPI     int             `json:"shimAPI"`
	ShimPath    string          `json:"shimPath,omitempty"`
	Encoders    map[string]bool `json:"encoders"`
	Muxers      map[string]bool `json:"muxers"`
	Filters     map[string]bool `json:"filters"`
	// Trials holds each trial encode's error message, "" for success.
	Trials map[string]string `json:"trials,omitempty"`
}

Report is what a check found; it is printed as JSON by --self-check.

func Check

func Check(ctx context.Context, class Class) (Report, error)

Check loads FFmpeg and the shim (ffruntime.Load) and checks class's encoders, filters and muxers, encoding a few frames with libx265 and AAC. The error names the first missing piece; the report says what was found up to there.

func Trial

func Trial(ctx context.Context, class Class, dir string) (Report, error)

Trial is Check plus a real encode on the class's device for each GPU path the class takes. It fails when every leg failed, and reports each.

type RuntimeLib

type RuntimeLib struct {
	// Name is a soname or a path; $VAR is expanded from the environment.
	Name    string
	Symbols []string
}

RuntimeLib is a library a class's image must be able to load at run time, with the symbols it must export: what nothing's DT_NEEDED names because FFmpeg (BtbN's library stubs), libva or libvpl dlopen it.

Jump to

Keyboard shortcuts

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