Documentation
¶
Overview ¶
Package media holds the domain types shared by every analysis stage.
Index ¶
Constants ¶
const ( // TransferPQ is the perceptual quantizer of SMPTE ST 2084: absolute // display light, up to 10 000 cd/m². TransferPQ = "smpte2084" // TransferHLG is hybrid log-gamma (ARIB STD-B67): relative scene light, // displayed at the peak luminance of the display. TransferHLG = "arib-std-b67" )
Transfer characteristics of the HDR signals of ITU-R BT.2100, as ffmpeg names them (Color.Transfer).
const HLGNominalPeak = 1000
HLGNominalPeak is the display peak luminance (cd/m²) HLG light levels and colour differences are computed for: the reference display of ITU-R BT.2100 and BT.2124 (conversion 4).
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AudioStream ¶
type AudioStream struct {
Index int `json:"index"`
Codec string `json:"codec"`
Profile string `json:"profile,omitempty"`
SampleRate int `json:"sampleRate"`
Channels int `json:"channels"`
ChannelLayout string `json:"channelLayout,omitempty"`
BitRate int64 `json:"bitRate,omitempty"`
Language string `json:"language,omitempty"`
// SampleFormat is the decoder's sample format (fltp, s16, s32p...).
SampleFormat string `json:"sampleFormat,omitempty"`
// BitDepth is the coded sample depth of PCM and lossless streams (0
// for lossy codecs, which have none).
BitDepth int `json:"bitDepth,omitempty"`
// StartTime is the stream's start on the container's timeline.
StartTime Duration `json:"startTime,omitempty"`
// Duration is the stream's duration, when the container tells.
Duration Duration `json:"duration,omitempty"`
// Default is true for the track players pick by default.
Default bool `json:"default,omitempty"`
}
AudioStream describes an audio elementary stream.
type Chromaticity ¶
Chromaticity is a CIE 1931 xy colour coordinate.
type Color ¶
type Color struct {
Range string `json:"range,omitempty"`
Space string `json:"space,omitempty"`
Transfer string `json:"transfer,omitempty"`
Primaries string `json:"primaries,omitempty"`
}
Color holds the signalled colour description of a stream.
type ContentLightLevel ¶
ContentLightLevel holds MaxCLL / MaxFALL in cd/m².
type DolbyVision ¶
type DolbyVision struct {
Profile int `json:"profile"`
Level int `json:"level"`
RPUPresent bool `json:"rpuPresent"`
ELPresent bool `json:"elPresent"`
BLPresent bool `json:"blPresent"`
CompatibilityID int `json:"compatibilityId"`
}
DolbyVision holds the Dolby Vision decoder configuration record.
type Duration ¶
Duration is a time.Duration serialised in JSON as decimal seconds, which is what charting tools and non-Go consumers expect.
func (Duration) MarshalJSON ¶
MarshalJSON implements json.Marshaler, rounded to the microsecond.
func (*Duration) UnmarshalJSON ¶
UnmarshalJSON implements json.Unmarshaler.
type DynamicRange ¶
type DynamicRange string
DynamicRange classifies how a stream is meant to be displayed.
const ( DynamicRangeSDR DynamicRange = "SDR" DynamicRangeHDR10 DynamicRange = "HDR10" DynamicRangeHLG DynamicRange = "HLG" DynamicRangePQ DynamicRange = "PQ" DynamicRangeDolbyVision DynamicRange = "DolbyVision" // DynamicRangeHDR10Plus is HDR10 with SMPTE ST 2094-40 dynamic // metadata, found in the frames (not at stream level). DynamicRangeHDR10Plus DynamicRange = "HDR10+" )
Dynamic range values.
type HDR ¶
type HDR struct {
DynamicRange DynamicRange `json:"dynamicRange"`
MasteringDisplay *MasteringDisplay `json:"masteringDisplay,omitempty"`
ContentLightLevel *ContentLightLevel `json:"contentLightLevel,omitempty"`
DolbyVision *DolbyVision `json:"dolbyVision,omitempty"`
// HDR10Plus is set when the first frame carries SMPTE ST 2094-40
// dynamic metadata (HDR10+).
HDR10Plus bool `json:"hdr10Plus,omitempty"`
}
HDR describes high dynamic range signalling found at stream level.
type Info ¶
type Info struct {
Path string `json:"path"`
Format string `json:"format"`
Duration Duration `json:"duration"`
Size int64 `json:"size"`
BitRate int64 `json:"bitRate"`
Video []VideoStream `json:"video"`
Audio []AudioStream `json:"audio"`
StartTime Duration `json:"startTime"`
}
Info describes a media file at container and stream level.
func (*Info) DefaultAudio ¶
DefaultAudio returns the index in Audio of the default track: the first flagged default, else the first track; -1 without audio.
func (*Info) PrimaryVideo ¶
func (i *Info) PrimaryVideo() (VideoStream, bool)
PrimaryVideo returns the first video stream, if any.
type MasteringDisplay ¶
type MasteringDisplay struct {
MinLuminance float64 `json:"minLuminance"`
MaxLuminance float64 `json:"maxLuminance"`
Red Chromaticity `json:"red,omitzero"`
Green Chromaticity `json:"green,omitzero"`
Blue Chromaticity `json:"blue,omitzero"`
WhitePoint Chromaticity `json:"whitePoint,omitzero"`
}
MasteringDisplay is the SMPTE ST 2086 mastering display colour volume: luminances in cd/m², primaries and white point as CIE 1931 xy.
type Packet ¶
type Packet struct {
PTS time.Duration
DTS time.Duration
Duration time.Duration
Size int
Keyframe bool
}
Packet is a compressed access unit as stored in the container.
type Rational ¶
Rational is an exact fraction such as a frame rate (30000/1001).
func ParseRational ¶
ParseRational parses "num/den" or a plain integer. An empty or zero-denominator input returns the zero Rational.
type VideoStream ¶
type VideoStream struct {
Index int `json:"index"`
Codec string `json:"codec"`
Profile string `json:"profile,omitempty"`
Level int `json:"level,omitempty"`
Width int `json:"width"`
Height int `json:"height"`
PixelFormat string `json:"pixelFormat"`
BitDepth int `json:"bitDepth"`
FrameRate Rational `json:"frameRate"`
AvgFrameRate Rational `json:"avgFrameRate"`
FrameCount int64 `json:"frameCount,omitempty"`
BitRate int64 `json:"bitRate,omitempty"`
Duration Duration `json:"duration"`
FieldOrder string `json:"fieldOrder,omitempty"`
SampleAspect string `json:"sampleAspectRatio,omitempty"`
// StartTime is the stream's start on the container's timeline.
StartTime Duration `json:"startTime,omitempty"`
Color Color `json:"color"`
HDR HDR `json:"hdr"`
}
VideoStream describes a video elementary stream.
func (VideoStream) MeasurableHDR ¶
func (v VideoStream) MeasurableHDR() bool
MeasurableHDR reports whether the decoded frames of the stream are a BT.2100 PQ or HLG Y′CbCr signal that light levels and HDR metrics can be computed on. A Dolby Vision stream without a compatible base layer (profile 5, compatibility id 0) codes IPTPQc2, which only its RPU turns into a picture: it is reported, not measured.