media

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Feb 18, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MP4  = "video/mp4"
	MKV  = "video/x-matroska"
	WebM = "video/webm"
	AVI  = "video/x-msvideo"
	MOV  = "video/quicktime"
	HLS  = "application/x-mpegURL"
)

Variables

View Source
var HLSInputArgs = []string{
	"-allowed_extensions", "ALL",
	"-allowed_segment_extensions", "ALL",
	"-extension_picky", "0",
	"-seg_format_options", "extension_picky=0",
}

HLSInputArgs contains ffmpeg/ffprobe flags that relax extension checks for HLS playlists and DASH manifests.

Functions

func DetectFromExtension

func DetectFromExtension(u *url.URL) string

DetectFromExtension returns a content type based on the URL's file extension, or empty string if unrecognized.

func DetectFromMIME

func DetectFromMIME(mime string) string

DetectFromMIME returns a content type based on a confirmed MIME type, or empty string if unrecognized.

func FormatHTTPHeaders

func FormatHTTPHeaders(headers map[string]string) string

FormatHTTPHeaders formats a map of headers into the ffmpeg/ffprobe -headers flag value: "Key: Value\r\nKey2: Value2\r\n".

func FormatToContentType

func FormatToContentType(format string) (string, error)

FormatToContentType maps an ffprobe format_name to a content type.

Types

type FormatInfo

type FormatInfo struct {
	ContentType string
	Extension   string
}

FormatInfo describes an output format.

func LookupFormat

func LookupFormat(name string) (FormatInfo, bool)

LookupFormat returns format info for an ffmpeg output format name.

type Stream

type Stream struct {
	URL         *url.URL
	Headers     map[string]string
	Bandwidth   int64
	ContentType string
}

Stream represents a resolved media stream.

type StreamInfo

type StreamInfo struct {
	BitRate     int64
	ContentType string
}

StreamInfo holds metadata returned by ffprobe for a stream.

Jump to

Keyboard shortcuts

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