Documentation
¶
Overview ¶
Package progress reports ffmpeg encode completion from stderr.
Index ¶
Constants ¶
View Source
const (
// TailSize is how much of ffmpeg's standard error a Writer keeps.
TailSize = 64 << 10
)
Variables ¶
This section is empty.
Functions ¶
func From ¶
From returns the progress callback stored on ctx, if any.
Parameters:
- ctx: Context that may carry a WithProgress callback.
Returns:
- fn: The callback, or nil when none is stored.
func WithProgress ¶
WithProgress attaches a progress callback to the context.
Parameters:
- ctx: Parent context.
- fn: Callback that receives the percent complete, from 0 to 99 and not rounded, so a slow encode still reports each step it takes.
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.
It keeps only the tail of what it was written, for error logs, and parses each write once, so a long encode costs the same per write as a short one.
func NewWriter ¶
NewWriter returns a stderr writer that reports encode progress.
Parameters:
- duration: Clip duration used to compute percent.
- on: Optional callback invoked with the percent complete, from 0 to 99.
Returns:
- writer: A writer that implements io.Writer and parses ffmpeg time= lines.
func (*Writer) Len ¶
Len returns how many bytes were written, including any no longer kept.
Returns:
- n: The total written.
Click to show internal directories.
Click to hide internal directories.