ffprobe

package
v0.0.9 Latest Latest
Warning

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

Go to latest
Published: May 3, 2026 License: AGPL-3.0 Imports: 6 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package ffprobe wraps the go-astiav CGo bindings to inspect media files.

Index

Constants

View Source
const (
	CodecNameH264 = "h264"
	CodecNameH265 = "hevc"
)

Video codec name constants as reported by ffprobe in StreamInfo.CodecName.

Variables

This section is empty.

Functions

This section is empty.

Types

type CodecType

type CodecType string

CodecType identifies the kind of media carried by a stream.

const (
	CodecTypeUnknown    CodecType = ""
	CodecTypeVideo      CodecType = "video"
	CodecTypeAudio      CodecType = "audio"
	CodecTypeData       CodecType = "data"
	CodecTypeSubtitle   CodecType = "subtitle"
	CodecTypeAttachment CodecType = "attachment"
)

type MediaInfo

type MediaInfo struct {
	Format        string
	Duration      time.Duration
	BitsPerSecond int64
	Tags          map[string]string
	Streams       []StreamInfo
}

MediaInfo holds top-level metadata for a media container.

func Probe

func Probe(ctx context.Context, path string) (*MediaInfo, error)

Probe opens the media file at path, reads its container and stream metadata, and returns a populated MediaInfo. It returns a non-nil error if the file does not exist, is not a recognized media format, or if ctx is cancelled.

type StreamInfo

type StreamInfo struct {
	Index         int
	CodecName     string
	CodecType     CodecType
	BitsPerSecond int64
	Tags          map[string]string
	// Video-only fields (zero for non-video streams).
	WidthPixels     int
	HeightPixels    int
	FramesPerSecond float64
	// Audio-only fields (zero for non-audio streams).
	AudioSampleRateHz int
	AudioChannelCount int
	// HasLFE is true when the audio stream's channel layout includes a dedicated
	// Low Frequency Effects (subwoofer) channel. Always false for non-audio streams.
	HasLFE bool
}

StreamInfo holds per-stream metadata.

Jump to

Keyboard shortcuts

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