fakeclip

package
v0.2.17 Latest Latest
Warning

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

Go to latest
Published: Dec 2, 2026 License: AGPL-3.0 Imports: 2 Imported by: 0 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 fakeclip builds small MP4 clips for tests, shaped like a battery camera's motion clips: H.264 video and, optionally, AAC-LC at 16 kHz mono, either as a plain file (sample tables in the moov, one mdat) or a fragmented one (an empty moov, then a moof+mdat pair per keyframe interval), the way a battery doorbell writes them.

Each sample carries its own index, so a test can tell which one it is looking at: see VideoIndex and AudioIndex.

Index

Constants

View Source
const (
	VideoScale = 90_000
	AudioScale = 16_000
)

The tracks' timescales: the video's, and the audio's (its sample rate).

Variables

This section is empty.

Functions

func AudioIndex

func AudioIndex(adts []byte) int

AudioIndex reads which AAC frame an ADTS frame is, or -1.

func Build

func Build(c Clip) []byte

Build makes the file.

func VideoIndex

func VideoIndex(au []byte) int

VideoIndex reads which picture an Annex-B access unit is, from the last NAL in it (the picture; parameter sets go in front), or -1.

Types

type Clip

type Clip struct {
	Fragmented bool
	// FPS is the picture rate; Frames pictures, a keyframe every KeyEvery.
	FPS, Frames, KeyEvery int
	// Stretch is how much longer than the rest, in VideoScale units, the
	// first picture lasts, as ffmpeg writes a fragmented file whose AAC
	// encoder primed: every picture after it starts that much later.
	Stretch int
	// AudioFrames is how many 1024 sample AAC frames there are, none for a
	// clip without sound. AudioDelay is how many samples after the first
	// picture the sound starts: an empty edit in a plain file, the first
	// tfdt in a fragmented one.
	AudioFrames, AudioDelay int
}

Clip describes the file Build makes.

Jump to

Keyboard shortcuts

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