ffprobe

package module
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Jan 27, 2024 License: MIT Imports: 6 Imported by: 1

README

GoDoc

ffprobe for Go

Tool to probe & read media files using ffmpeg.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Chapter added in v0.0.2

type Chapter struct {
	Id        int64             `json:"id"`
	TimeBase  Fraction          `json:"time_base"`
	Start     int64             `json:"start"`
	StartTime float64           `json:"start_time,string"`
	End       int64             `json:"end"`
	EndTime   float64           `json:"end_time,string"`
	Tags      map[string]string `json:"tags,omitempty"`
}

type File

type File struct {
	Streams  []*Stream  `json:"streams"`
	Chapters []*Chapter `json:"chapters"`
	Format   *Format    `json:"format"`
	// contains filtered or unexported fields
}

func Probe

func Probe(fn string) (*File, error)

func (*File) Audio added in v0.0.3

func (info *File) Audio() *Stream

Audio returns the first audio stream of the file or nil if none found

func (*File) GetStream added in v0.0.3

func (info *File) GetStream(typ string) *Stream

GetStream returns the first stream of a given type or nil if no such stream

func (*File) GetStreams added in v0.0.3

func (info *File) GetStreams(typ string) []*Stream

GetStreams returns all the streams in the file of a given codec type

func (*File) Video added in v0.0.3

func (info *File) Video() *Stream

Video returns the first video stream of the file or nil if none found

type Format

type Format struct {
	Filename       string            `json:"filename"`
	FormatName     string            `json:"format_name"`       // mov,mp4,m4a,3gp,3g2,mj2
	FormatLongName string            `json:"format_long_name"`  // QuickTime / MOV
	StartTime      float64           `json:"start_time,string"` // "start_time": "0.000000",
	Duration       float64           `json:"duration,string"`   // "duration": "240.048000",
	Size           int64             `json:"size,string"`       // "size": "73087904",
	BitRate        int               `json:"bit_rate,string"`   // "bit_rate": "2435776",
	Tags           map[string]string `json:"tags"`
}

type Fraction added in v0.0.2

type Fraction string // typically: 25/1, 30000/1001 or 1/90000 etc

func (Fraction) Frac added in v0.0.2

func (f Fraction) Frac() (int, int)

func (Fraction) Value added in v0.0.2

func (f Fraction) Value() float64

Value returns the float value for the given framerate, or math.NaN() if the value could not be parsed

type Stream

type Stream struct {
	Index          int      `json:"index"` // stream index
	CodecName      string   `json:"codec_name"`
	CodecLongName  string   `json:"codec_long_name"`
	Profile        string   `json:"profile"`
	CodecType      string   `json:"codec_type"`       // video
	CodecTagString string   `json:"codec_tag_string"` // avc1
	CodecTag       string   `json:"codec_tag"`        // 0x31637661
	Width          int      `json:"width,omitempty"`
	Height         int      `json:"height,omitempty"`
	CodedWidth     int      `json:"coded_width"`
	CodedHeight    int      `json:"coded_height"`
	ClosedCaptions int      `json:"closed_captions"`
	FrameRate      Fraction `json:"r_frame_rate"`
	AvgFrameRate   Fraction `json:"avg_frame_rate"`
	TimeBase       Fraction `json:"time_base"`
	SampleRate     int      `json:"sample_rate,string"`
	Duration       float64  `json:"duration,string"`
	DurationTs     uint64   `json:"duration_ts"`
	StartTime      float64  `json:"start_time,string"` // can be negative
	StartPTS       int      `json:"start_pts"`
	ExtradataSize  int      `json:"extradata_size"`

	Disposition *struct {
		Default         int `json:"default"`
		Dub             int `json:"dub"`
		Original        int `json:"original"`
		Comment         int `json:"comment"`
		Lyrics          int `json:"lyrics"`
		Karaoke         int `json:"karaoke"`
		Forced          int `json:"forced"`
		HearingImpaired int `json:"hearing_impaired"`
		VisualImpaired  int `json:"visual_impaired"`
		CleanEffects    int `json:"clean_effects"`
		AttachedPic     int `json:"attached_pic"`
		TimedThumbnails int `json:"timed_thumbnails"`
		Captions        int `json:"captions"`
		Descriptions    int `json:"descriptions"`
		Metadata        int `json:"metadata"`
		Dependent       int `json:"dependent"`
		StillImage      int `json:"still_image"`
	} `json:"disposition,omitempty"`

	Tags map[string]string `json:"tags"`
}

Jump to

Keyboard shortcuts

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