webm

package
v0.11.0 Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2026 License: BSD-3-Clause Imports: 10 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 webm encodes a capture.Result as a VP8 WebM video of the same frames. It is a separate package so that a user of capture who only wants SVG or HTML does not compile the encoder or the rasteriser.

Index

Constants

View Source
const (
	// FPS is the nominal frame rate. Timestamps come from the scenario's own
	// holds; this only sizes the last frame's duration.
	FPS = 25
	// CPUUsed is the encoder speed preset.
	CPUUsed = 4
	// DefaultQuality is the VP8 quantizer index held: 1 (best) to 63 (worst).
	DefaultQuality = 10
	// MinQuality and MaxQuality bound the quality: avkit's vp8enc takes
	// 1 to 63 (the bitstream's own quantizer index is 7 bits, RFC 6386 section 9.6).
	MinQuality, MaxQuality = 1, 63
)

The WebM encoder settings. CPUUsed 4 is avkit's slow, sharp preset (the default 5 costs about 5 dB), right for UI text; the frames are few and the encode is bounded by Quality, a constant quantizer, so the file size follows the content.

Variables

This section is empty.

Functions

func CheckQuality

func CheckQuality(quality int) error

CheckQuality refuses a quality outside 1 to 63 (0 is the default). Any size is taken: avkit's vp8enc pads the planes to whole macroblocks itself (v0.20.2).

func Encode

func Encode(r *capture.Result, w, h, quality int) ([]byte, error)

Encode rasterises the frames of r at w x h and encodes them as a VP8 WebM. quality 0 means DefaultQuality; w and h are the size r was recorded at.

Types

type Rasterizer

type Rasterizer struct{}

Rasterizer paints a still frame with go-gfx/gfx/svg, at one pixel per user unit: the frames are the SVG's own, there is no second drawing path.

func (Rasterizer) Rasterize

func (Rasterizer) Rasterize(doc []byte, w, h int) (*image.NRGBA, error)

Rasterize implements svg.Rasterizer.

Jump to

Keyboard shortcuts

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