framerate

package
v0.1.147 Latest Latest
Warning

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

Go to latest
Published: Jul 17, 2026 License: GPL-2.0, GPL-3.0 Imports: 0 Imported by: 0

Documentation

Overview

Package framerate provides framerate drift detection for subtitle alignment.

Index

Constants

View Source
const MinLinearR2 = 0.8

MinLinearR2 is the minimum R² (coefficient of determination) for drift to be considered linear (indicating a framerate mismatch rather than random or constant offset). Below this threshold, drift is non-linear.

Variables

View Source
var KnownFramerates = []float64{
	23.976,
	24.0,
	25.0,
	29.97,
	30.0,
	48.0,
	50.0,
	59.94,
	60.0,
}

KnownFramerates contains common video framerates and their NTSC/PAL conversions.

View Source
var KnownRatios = buildKnownRatios()

KnownRatios contains all common framerate conversion pairs.

Functions

func LinearRegression

func LinearRegression(points []DriftPoint) (slope, intercept, r2 float64)

LinearRegression fits y = slope*x + intercept to the drift points.

Types

type DriftPoint

type DriftPoint struct {
	TimeMs  float64
	DriftMs float64
}

DriftPoint represents a measured drift at a timeline position.

type RatioPair

type RatioPair struct {
	From, To float64
	Ratio    float64 // To / From
}

RatioPair represents a source→target framerate conversion.

Jump to

Keyboard shortcuts

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