Documentation
¶
Index ¶
- Constants
- Variables
- type Bool
- type Configuration
- type Disposition
- type Duration
- type Executer
- type FFProbe
- func (f *FFProbe) Format(ctx context.Context, src string) (ft Format, err error)
- func (f *FFProbe) Frames(ctx context.Context, src string, streamIndex int) (fs []Frame, err error)
- func (f *FFProbe) Packets(ctx context.Context, src string, streamIndex int) (ps []Packet, err error)
- func (f *FFProbe) PacketsOrdered(ctx context.Context, src string, streamIndex int) (ps []Packet, err error)
- func (f *FFProbe) Streams(ctx context.Context, src string) (ss []Stream, err error)
- type Format
- type Frame
- type Hexadecimal
- type Output
- type Packet
- type Rational
- type Stream
Constants ¶
const ( ChannelLayout51 = "5.1" ChannelLayout51Side = "5.1(side)" ChannelLayoutMono = "mono" ChannelLayoutStereo = "stereo" )
Channel layouts
const ( CodecNameAC3 = "ac3" CodecNameDVBSub = "dvbsub" CodecNameDVBTeletext = "dvb_teletext" CodecNameH264 = "h264" )
Codec names
const ( CodecTypeAudio = "audio" CodecTypeSubtitle = "subtitle" CodecTypeVideo = "video" )
Codec types
const ( ProfileBaseline = "baseline" ProfileHight = "high" ProfileMain = "main" )
Profiles
const (
PixelFormatYuv420p = "yuv420p"
)
Pixel formats
Variables ¶
var (
BinaryPath = flag.String("ffprobe-binary-path", "", "the FFProbe binary path")
)
Flags
Functions ¶
This section is empty.
Types ¶
type Bool ¶
type Bool bool
Bool represents a boolean in an int format
func (*Bool) UnmarshalJSON ¶
UnmarshalText implements the JSONUnmarshaler interface We need to use UnmarshalJSON instead of UnmarshalText otherwise it fails
type Configuration ¶
type Configuration struct {
BinaryPath string `toml:"binary_path"`
}
Configuration represents the ffmpeg configuration
func FlagConfig ¶
func FlagConfig() Configuration
FlagConfig generates a Configuration based on flags
type Disposition ¶
type Disposition struct { AttachedPic Bool `json:"attached_pic"` CleanEffects Bool `json:"clean_effects"` Comment Bool `json:"comment"` Default Bool `json:"default"` Dub Bool `json:"dub"` Forced Bool `json:"forced"` HearingImpaired Bool `json:"hearing_impaired"` Karaoke Bool `json:"karaoke"` Lyrics Bool `json:"lyrics"` Original Bool `json:"original"` TimedThumbnails Bool `json:"timed_thumbnails"` VisualImpaired Bool `json:"visual_impaired"` }
Disposition represents a stream disposition
type Duration ¶
Duration represents a duration in a string format "1.203" such as the duration is 1.203s
func (*Duration) UnmarshalText ¶
UnmarshalText implements the TextUnmarshaler interface
type Executer ¶
type Executer interface {
// contains filtered or unexported methods
}
Executer represents an executer
type FFProbe ¶
type FFProbe struct {
// contains filtered or unexported fields
}
FFProbe represents an entity capable of running an FFProbe binary
func (*FFProbe) Packets ¶
func (f *FFProbe) Packets(ctx context.Context, src string, streamIndex int) (ps []Packet, err error)
Packets returns the unordered packets of a stream
type Format ¶
type Format struct { Bitrate int64 `json:"bit_rate,string"` Duration Duration `json:"duration"` Filename string `json:"filename"` FormatName string `json:"format_name"` FormatNameLong string `json:"format_long_name"` NumberOfPrograms int `json:"nb_programs"` NumberOfStreams int `json:"nb_streams"` ProbeScore int `json:"probe_score"` Size int64 `json:"size,string"` StartTime Duration `json:"start_time"` }
Format represents a format
type Frame ¶
type Frame struct { // frame timestamp estimated using various heuristics BestEffortTimestamp int `json:"best_effort_timestamp"` BestEffortTimestampTime Duration `json:"best_effort_timestamp_time"` // picture number in bitstream order CodedPictureNumber int `json:"coded_picture_number"` DisplayPictureNumber int `json:"display_picture_number"` Height int `json:"height"` InterlacedFrame Bool `json:"interlaced_frame"` KeyFrame Bool `json:"key_frame"` MediaType string `json:"media_type"` PictType string `json:"pict_type"` PixFmt string `json:"pix_fmt"` // duration of the corresponding packet, expressed in AVStream->time_base units, 0 if unknown PktDuration int `json:"pkt_duration"` PktDurationTime Duration `json:"pkt_duration_time"` // DTS copied from the AVPacket that triggered returning this frame PktDts int `json:"pkt_dts"` PktDtsTime Duration `json:"pkt_dts_time"` // reordered pos from the last AVPacket that has been input into the decoder PktPos int `json:"pkt_pos,string"` // PTS copied from the AVPacket that was decoded to produce this frame PktPts int `json:"pkt_pts"` PktPtsTime Duration `json:"pkt_pts_time"` // size of the corresponding packet containing the compressed frame PktSize int `json:"pkt_size,string"` RepeatPict Bool `json:"repeat_pict"` SampleAspectRatio Rational `json:"sample_aspect_ratio"` StreamIndex int `json:"stream_index"` ToFieldFirst Bool `json:"top_field_first"` Width int `json:"width"` }
Frame represents a frame
type Hexadecimal ¶
type Hexadecimal string
Hexadecimal represents an int in hexadecimal format
func (*Hexadecimal) UnmarshalText ¶
func (h *Hexadecimal) UnmarshalText(b []byte) (err error)
Hexadecimal implements the TextUnmarshaler interface
type Output ¶
type Output struct { Format Format `json:"format"` Frames []Frame `json:"frames"` Packets []Packet `json:"packets"` Streams []Stream `json:"streams"` }
Output represents the object FFProbe outputs https://ffmpeg.org/doxygen/2.7/structAVFrame.html
type Packet ¶
type Packet struct { CodecType string `json:"codec_type"` Dts int `json:"dts"` DtsTime Duration `json:"dts_time"` Duration int `json:"duration"` DurationTime Duration `json:"duration_time"` Flags string `json:"flags"` Position int `json:"position,string"` Pts int `json:"pts"` PtsTime Duration `json:"pts_time"` Size int `json:"size,string"` StreamIndex int `json:"stream_index"` }
Packet represents a packet
type Rational ¶ added in v0.3.0
type Rational struct {
astikit.Rational
}
Rational represents a rational either in "25/1" or "16:9" format
func (*Rational) UnmarshalText ¶ added in v0.3.0
UnmarshalText implements the TextUnmarshaler interface
type Stream ¶
type Stream struct { AvgFramerate Rational `json:"avg_frame_rate"` Bitrate int64 `json:"bit_rate,string"` BitsPerRawSample int64 `json:"bits_per_raw_sample,string"` ChannelLayout string `json:"channel_layout"` Channels int `json:"channels"` ChromaLocation string `json:"chroma_location"` CodecLongName string `json:"codec_long_name"` CodecName string `json:"codec_name"` CodecTag string `json:"codec_tag"` CodecTagString string `json:"codec_tag_string"` CodecTimeBase string `json:"codec_time_base"` CodecType string `json:"codec_type"` CodedHeight int `json:"coded_height"` CodedWidth int `json:"coded_width"` ColorPrimaries string `json:"color_primaries"` ColorRange string `json:"color_range"` ColorSpace string `json:"color_space"` ColorTransfer string `json:"color_transfer"` DisplayAspectRatio Rational `json:"display_aspect_ratio"` Disposition Disposition `json:"disposition"` Duration Duration `json:"duration"` DurationTs int64 `json:"duration_ts"` HasBFrames int `json:"has_b_frames"` Height int `json:"height"` ID Hexadecimal `json:"id"` Index int `json:"index"` IsAVC bool `json:"is_avc,string"` Level int `json:"level"` NalLengthSize int `json:"nal_length_size,string"` NbFrames int64 `json:"nb_frames,string"` PixFmt string `json:"pix_fmt"` Profile string `json:"profile"` Refs int64 `json:"refs"` RFrameRate Rational `json:"r_frame_rate"` SampleAspectRatio Rational `json:"sample_aspect_ratio"` SampleFmt string `json:"sample_fmt"` SampleRate int `json:"sample_rate,string"` StartPts int64 `json:"start_pts"` StartTime Duration `json:"start_time"` Tags map[string]string `json:"tags"` TimeBase Rational `json:"time_base"` Width int `json:"width"` }
Stream represents a stream