progress

package
v0.2.0 Latest Latest
Warning

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

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

Documentation

Overview

Package progress reports ffmpeg encode completion from stderr.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func From

func From(ctx context.Context) func(int)

From returns the progress callback stored on ctx, if any.

Parameters:

Returns:

  • fn: The callback, or nil when none is stored.

func WithProgress

func WithProgress(ctx context.Context, fn func(percent int)) context.Context

WithProgress attaches a progress callback to the context.

Parameters:

  • ctx: Parent context.
  • fn: Callback that receives a 0-99 percent complete value.

Returns:

  • ctx: A child context that carries fn.

Types

type Writer

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

Writer parses ffmpeg stderr and reports percent complete.

func NewWriter

func NewWriter(duration float64, on func(int)) *Writer

NewWriter returns a stderr writer that reports encode progress.

Parameters:

  • duration: Clip duration in seconds used to compute percent.
  • on: Optional callback invoked with 0-99 percent complete.

Returns:

  • writer: A writer that implements io.Writer and parses ffmpeg time= lines.

func (*Writer) Len

func (writer *Writer) Len() int

Len returns the number of captured stderr bytes.

Returns:

  • n: The captured buffer length.

func (*Writer) String

func (writer *Writer) String() string

String returns the captured stderr text.

Returns:

  • text: Bytes written so far as a string.

func (*Writer) Write

func (writer *Writer) Write(p []byte) (int, error)

Write implements io.Writer and reports ffmpeg time= progress.

Jump to

Keyboard shortcuts

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