cmd

package module
v0.0.0-...-44ac78e Latest Latest
Warning

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

Go to latest
Published: Aug 29, 2019 License: MIT Imports: 18 Imported by: 0

README

go-ffmpeg-cmd

Documentation

Index

Constants

View Source
const (
	Scale480P  = 0
	Scale720P  = 1
	Scale1080P = 2
)

Scale ...

View Source
const (
	CNameIdx = iota
	ExtIdx
	CaptionIdx
	LanguageIdx
	AudioIdx
	VideoIdx
	SharpnessIdx
	DataIdx
	ENameIdx
	MaxSizeIdx
)

ExtIdx ...

Variables

This section is empty.

Functions

func FFMpegRun

func FFMpegRun(ctx Context, args string) (e error)

FFMpegRun ...

func GetCurrentDir

func GetCurrentDir() string

GetCurrentDir ...

Types

type Command

type Command struct {
	Path string
	Name string
	Args []string
}

Command ...

func New

func New(name string) *Command

New ...

func NewFFMpeg

func NewFFMpeg() *Command

NewFFMpeg ...

func NewFFProbe

func NewFFProbe() *Command

NewFFProbe ...

func (*Command) AddArgs

func (c *Command) AddArgs(s string)

AddArgs ...

func (*Command) CMD

func (c *Command) CMD() string

CMD ...

func (*Command) Env

func (c *Command) Env() []string

Env ...

func (*Command) Run

func (c *Command) Run() (string, error)

Run ...

func (*Command) RunContext

func (c *Command) RunContext(ctx Context, info chan<- string) (e error)

RunContext ...

func (*Command) SetArgs

func (c *Command) SetArgs(s string)

SetArgs ...

func (*Command) SetPath

func (c *Command) SetPath(s string)

SetPath ...

type Context

type Context interface {
	Cancel()
	Add(int)
	Waiting() <-chan bool
	Wait()
	Done()
	Context() context.Context
}

Context ...

func FFmpegContext

func FFmpegContext() Context

FFmpegContext ...

type FileInfo

type FileInfo struct {
	Ext       string //扩展名
	Caption   string //字幕
	Language  string //语种
	Audio     string //音频
	Video     string //视频
	Sharpness string //清晰度
	Date      string //年份
	CName     string //中文名
	EName     string //英文名
	Prefix    string //前缀(广告信息)
}

FileInfo ...

func NameAnalyze

func NameAnalyze(filename string) *FileInfo

NameAnalyze ...

func (*FileInfo) ToString

func (info *FileInfo) ToString() string

ToString ...

type Format

type Format struct {
	Filename       string     `json:"filename"`
	NbStreams      int64      `json:"nb_streams"`
	NbPrograms     int64      `json:"nb_programs"`
	FormatName     string     `json:"format_name"`
	FormatLongName string     `json:"format_long_name"`
	StartTime      string     `json:"start_time"`
	Duration       string     `json:"duration"`
	Size           string     `json:"size"`
	BitRate        string     `json:"bit_rate"`
	ProbeScore     int64      `json:"probe_score"`
	Tags           FormatTags `json:"tags"`
}

Format ...

func (*Format) NameAnalyze

func (f *Format) NameAnalyze() *FileInfo

NameAnalyze ...

type FormatTags

type FormatTags struct {
	MajorBrand       string `json:"major_brand"`
	MinorVersion     string `json:"minor_version"`
	CompatibleBrands string `json:"compatible_brands"`
	Encoder          string `json:"encoder"`
}

FormatTags ...

type SplitArgs

type SplitArgs struct {
	StreamFormat    *StreamFormat
	Auto            bool
	Scale           int64
	Start           string
	End             string
	Output          string
	Video           string
	Audio           string
	M3U8            string
	SegmentFileName string
	HLSTime         int

	BitRate   int64
	FrameRate float64
	// contains filtered or unexported fields
}

SplitArgs ...

func FFMpegSplitToM3U8

func FFMpegSplitToM3U8(ctx Context, file string, args ...SplitOptions) (sa *SplitArgs, e error)

FFMpegSplitToM3U8 ...

func FFMpegSplitToM3U8WithOptimize

func FFMpegSplitToM3U8WithOptimize(ctx Context, file string, args ...SplitOptions) (sa *SplitArgs, e error)

FFMpegSplitToM3U8WithOptimize ...

func FFMpegSplitToM3U8WithProbe

func FFMpegSplitToM3U8WithProbe(ctx Context, file string, args ...SplitOptions) (sa *SplitArgs, e error)

FFMpegSplitToM3U8WithProbe ...

type SplitOptions

type SplitOptions func(args *SplitArgs)

SplitOptions ...

func AudioOption

func AudioOption(s string) SplitOptions

AudioOption ...

func AutoOption

func AutoOption(s bool) SplitOptions

AutoOption ...

func BitRateOption

func BitRateOption(b int64) SplitOptions

BitRateOption ...

func HLSTimeOption

func HLSTimeOption(i int) SplitOptions

HLSTimeOption ...

func OutputOption

func OutputOption(s string) SplitOptions

OutputOption ...

func ProbeInfoOption

func ProbeInfoOption(f func(string) (*StreamFormat, error)) SplitOptions

ProbeInfoOption ...

func ScaleOption

func ScaleOption(s int64, v ...string) SplitOptions

ScaleOption ...

func StreamFormatOption

func StreamFormatOption(s *StreamFormat) SplitOptions

StreamFormatOption ...

func VideoOption

func VideoOption(s string) SplitOptions

VideoOption ...

type Stream

type Stream struct {
	Index              int64            `json:"index"`
	CodecName          string           `json:"codec_name"`
	CodecLongName      string           `json:"codec_long_name"`
	Profile            string           `json:"profile"`
	CodecType          string           `json:"codec_type"`
	CodecTimeBase      string           `json:"codec_time_base"`
	CodecTagString     string           `json:"codec_tag_string"`
	CodecTag           string           `json:"codec_tag"`
	Width              *int64           `json:"width,omitempty"`
	Height             *int64           `json:"height,omitempty"`
	CodedWidth         *int64           `json:"coded_width,omitempty"`
	CodedHeight        *int64           `json:"coded_height,omitempty"`
	HasBFrames         *int64           `json:"has_b_frames,omitempty"`
	SampleAspectRatio  *string          `json:"sample_aspect_ratio,omitempty"`
	DisplayAspectRatio *string          `json:"display_aspect_ratio,omitempty"`
	PixFmt             *string          `json:"pix_fmt,omitempty"`
	Level              *int64           `json:"level,omitempty"`
	ColorRange         *string          `json:"color_range,omitempty"`
	ColorSpace         *string          `json:"color_space,omitempty"`
	ColorTransfer      *string          `json:"color_transfer,omitempty"`
	ColorPrimaries     *string          `json:"color_primaries,omitempty"`
	ChromaLocation     *string          `json:"chroma_location,omitempty"`
	Refs               *int64           `json:"refs,omitempty"`
	IsAVC              *string          `json:"is_avc,omitempty"`
	NalLengthSize      *string          `json:"nal_length_size,omitempty"`
	RFrameRate         string           `json:"r_frame_rate"`
	AvgFrameRate       string           `json:"avg_frame_rate"`
	TimeBase           string           `json:"time_base"`
	StartPts           int64            `json:"start_pts"`
	StartTime          string           `json:"start_time"`
	DurationTs         int64            `json:"duration_ts"`
	Duration           string           `json:"duration"`
	BitRate            string           `json:"bit_rate"`
	BitsPerRawSample   *string          `json:"bits_per_raw_sample,omitempty"`
	NbFrames           string           `json:"nb_frames"`
	Disposition        map[string]int64 `json:"disposition"`
	Tags               StreamTags       `json:"tags"`
	SampleFmt          *string          `json:"sample_fmt,omitempty"`
	SampleRate         *string          `json:"sample_rate,omitempty"`
	Channels           *int64           `json:"channels,omitempty"`
	ChannelLayout      *string          `json:"channel_layout,omitempty"`
	BitsPerSample      *int64           `json:"bits_per_sample,omitempty"`
	MaxBitRate         *string          `json:"max_bit_rate,omitempty"`
}

Stream ...

type StreamFormat

type StreamFormat struct {
	Streams []Stream `json:"streams"`
	Format  Format   `json:"format"`
}

StreamFormat ...

func FFProbeStreamFormat

func FFProbeStreamFormat(filename string) (*StreamFormat, error)

FFProbeStreamFormat ...

func (*StreamFormat) Audio

func (f *StreamFormat) Audio() *Stream

Audio ...

func (*StreamFormat) IsVideo

func (f *StreamFormat) IsVideo() bool

IsVideo ...

func (*StreamFormat) NameAnalyze

func (f *StreamFormat) NameAnalyze() *FileInfo

NameAnalyze 解析

func (*StreamFormat) Resolution

func (f *StreamFormat) Resolution() string

Resolution ...

func (*StreamFormat) ResolutionInt

func (f *StreamFormat) ResolutionInt() int

ResolutionInt ...

func (*StreamFormat) Video

func (f *StreamFormat) Video() *Stream

Video ...

type StreamTags

type StreamTags struct {
	Language    string `json:"language"`
	HandlerName string `json:"handler_name"`
}

StreamTags ...

Jump to

Keyboard shortcuts

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