Help us shape the future of Go! Take the 2026 Go Developer Survey

probe

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Oct 5, 2026 License: AGPL-3.0 Imports: 12 Imported by: 0

Documentation

Overview

Package probe reads what a source file actually is, using ffprobe.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func StoreCrop

func StoreCrop(path string, key Key, start, window time.Duration, rect crop.CropRect)

StoreCrop caches a crop rectangle, but only if the source file is unchanged since the analysis read its identity.

Parameters:

  • path: Cleaned source path, re-read to confirm the identity.
  • key: Cache identity of the source file.
  • start: Seek offset.
  • window: Sampling window.
  • rect: Result to store.

func StorePeak

func StorePeak(path string, key Key, start, window time.Duration, peak float64)

StorePeak caches a PQ luma peak under the same identity rules as StoreCrop.

Parameters:

  • path: Cleaned source path, re-read to confirm the identity.
  • key: Cache identity of the source file.
  • start: Seek offset.
  • window: Sampling window.
  • peak: Result to store.

Types

type Info

type Info struct {
	Duration      time.Duration `json:"duration"`
	Width         int           `json:"width"`
	Height        int           `json:"height"`
	VideoCodec    string        `json:"video_codec"`
	AudioCodec    string        `json:"audio_codec"`
	Format        string        `json:"format"`
	BitRate       int64         `json:"bit_rate"`
	ColorTransfer string        `json:"color_transfer"`
	AudioTracks   []Track       `json:"audio_tracks"`
}

Info represents media file information.

func Probe

func Probe(ctx context.Context, ffprobePath, path string) (Info, error)

Probe reads a media file for information.

Parameters:

  • ctx: Cancellation and deadline for the probe.
  • ffprobePath: Path to the ffprobe binary.
  • path: Media file path.

Returns:

  • info: The probed media information.
  • err: Non-nil when the file cannot be probed.

type Key

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

Key is a probed file's identity on disk.

func KeyFor

func KeyFor(path string) (Key, bool)

KeyFor builds the cache identity for a path, reporting whether the file can be identified on disk.

Parameters:

  • path: Media file path.

Returns:

  • key: The cache identity for the file.
  • ok: False when the file cannot be stat'd.

func (Key) CachedCrop

func (key Key) CachedCrop(start, window time.Duration) (crop.CropRect, bool)

CachedCrop returns a cached crop rectangle for one analysis.

Parameters:

  • start: Seek offset.
  • window: Sampling window, already clamped by the caller.

Returns:

  • rect: The cached rectangle.
  • ok: True when the file had been analyzed and still is that file.

func (Key) CachedPeak

func (key Key) CachedPeak(start, window time.Duration) (float64, bool)

CachedPeak returns a cached PQ luma peak for one analysis.

Parameters:

  • start: Seek offset.
  • window: Sampling window, already clamped by the caller.

Returns:

  • peak: The cached peak.
  • ok: True when the file had been analyzed and still is that file.

type Track

type Track struct {
	Index    int
	Codec    string
	Language string
	Title    string
	Channels int
}

Track is one audio stream on a source file.

Jump to

Keyboard shortcuts

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