ffprobe

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Oct 13, 2026 License: MIT Imports: 14 Imported by: 0

Documentation

Overview

Package ffprobe runs the bundled ffprobe binary against an HTTP video URL and returns its embedded chapters. ffprobe reads container headers through byte ranges, so a large camera original is never downloaded completely.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RegisterRoutes added in v0.2.0

func RegisterRoutes(e *echo.Echo, diagnostic Diagnostic, curatorGuard echo.MiddlewareFunc)

Types

type Chapter

type Chapter struct {
	Title string  `json:"title"`
	Start float64 `json:"start"`
	End   float64 `json:"end"`
}

Chapter is one read-only navigation segment, in seconds from the start.

func Parse

func Parse(output []byte) ([]Chapter, error)

Parse reads ffprobe's JSON chapter listing. Times arrive as decimal strings.

type Command

type Command struct {
	Path    string
	Timeout time.Duration
}

Command locates and bounds the ffprobe process. The zero value uses the ffprobe on PATH with a one-minute budget.

func (Command) Chapters

func (c Command) Chapters(ctx context.Context, url string, headers map[string]string) ([]Chapter, error)

Chapters probes url with the given request headers. Missing chapters are an empty, successful result.

func (Command) Check added in v0.2.0

func (c Command) Check(ctx context.Context) Status

Check runs the binary once with -version so Settings can show that chapter extraction has a working ffprobe. It reads no video.

type Diagnostic added in v0.2.0

type Diagnostic interface {
	Check(context.Context) Status
}

Diagnostic is the Settings seam for the chapter probe.

type Error

type Error struct {
	Detail string
}

Error is a failed probe. Detail is ffprobe's own explanation with the URL and every request header value removed, so the message never repeats a key.

func (*Error) Error

func (e *Error) Error() string

type Status added in v0.2.0

type Status struct {
	Usable  bool   `json:"usable"`
	Version string `json:"version"`
	Message string `json:"message"`
}

Status is the Settings diagnostic for chapter extraction. Version is what the binary reports; the configured path and process output stay out of it.

Jump to

Keyboard shortcuts

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