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

ffmpeg

package
v0.28.1 Latest Latest
Warning

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

Go to latest
Published: Oct 23, 2026 License: MIT Imports: 15 Imported by: 0

Documentation

Overview

Package ffmpeg renders a keryx timeline into a finished MP4 by shelling out to ffmpeg — the default Renderer adapter (spec §3.4). The command/filtergraph construction (buildArgs) is pure and unit-tested; the exec is injected so the logic tests run without ffmpeg, and the real renderer is exercised by integration tests. Faithful port of gen-reel.py's ffmpeg assembly.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ProbeDuration

func ProbeDuration(ctx context.Context, path string) (float64, error)

ProbeDuration returns a media file's duration in seconds via ffprobe (used to derive VO-driven card timing). Faithful to gen-reel.py's probe_dur.

Types

type Renderer

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

Renderer is the local-ffmpeg implementation of provider.Renderer.

func New

func New() *Renderer

New returns a Renderer that shells out to the system ffmpeg.

func (*Renderer) DetectSilence added in v0.4.0

func (r *Renderer) DetectSilence(ctx context.Context, fs afero.Fs, path string) ([]provider.Silence, error)

DetectSilence runs the silencedetect filter over path (materialising a non-OS fs first) and returns the detected intervals — the optional SilenceDetector capability for VO take screening (spec 0023). `-f null` discards the decoded audio; the filter logs the silences to stderr, which realExec captures via CombinedOutput.

func (*Renderer) Probe

func (r *Renderer) Probe(ctx context.Context, fs afero.Fs, path string) (float64, error)

Probe returns a media file's duration in seconds via ffprobe. For a non-OS fs the file is materialised to a temp path first (ffprobe reads only real OS files).

func (*Renderer) Render

func (r *Renderer) Render(ctx context.Context, fs afero.Fs, t provider.Timeline) (provider.Video, error)

Render assembles the timeline (whose paths are in fs) into t.OutputPath. The ffmpeg binary can only read real OS files: when fs is OS-backed the timeline paths are used directly; otherwise (an in-memory / git-worktree fs) the inputs are materialised to a temp dir, rendered, and the mp4 copied back into fs.

func (*Renderer) RenderProgress added in v0.8.0

func (r *Renderer) RenderProgress(ctx context.Context, fs afero.Fs, t provider.Timeline, onProgress func(provider.Progress)) (provider.Video, error)

RenderProgress renders while streaming a live percentage to onProgress, satisfying provider.ProgressRenderer (spec 0026). It taps ffmpeg's `-progress` output against the timeline's total duration; a nil onProgress behaves like Render.

Jump to

Keyboard shortcuts

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