tool

package module
v0.0.33 Latest Latest
Warning

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

Go to latest
Published: Apr 15, 2021 License: MIT Imports: 18 Imported by: 0

README

go-fftool

A new ffmpeg tool to make slice

Documentation

Index

Constants

View Source
const (
	ProcessNone             = ""
	ProcessH264CPU          = "libx264"
	ProcessH264QSV          = "h264_qsv"
	ProcessH264AMF          = "h264_amf"
	ProcessH264NVENC        = "h264_nvenc"
	ProcessH264VideoToolBox = "h264_videotoolbox"
	ProcessHevcCPU          = "libx265"
	ProcessHevcQSV          = "hevc_qsv"
	ProcessHevcAMF          = "hevc_amf"
	ProcessHevcNVENC        = "hevc_nvenc"
	ProcessHevcVideoToolBox = "hevc_videotoolbox"
	ProcessCUVID            = "cuvid"
)

None ...

Variables

View Source
var DefaultCommandPath = ""

DefaultCommandPath default point to current dir

View Source
var DefaultHLSTime = 10

DefaultHLSTime ...

View Source
var DefaultKeyInfoName = "m3u8_key_info"

DefaultKeyInfoName ...

View Source
var DefaultKeyName = "m3u8_key"

DefaultKeyName ...

View Source
var DefaultKeyPath = "output_key"

DefaultKeyPath ...

View Source
var DefaultM3U8Name = "index.m3u8"

DefaultM3U8Name ...

View Source
var DefaultMpegName = "ffmpeg"

DefaultMpegName ...

View Source
var DefaultOpenSSLName = "openssl"

DefaultOpenSSLName ...

View Source
var DefaultOutputName = "index.mp4"

DefaultOutputName ...

View Source
var DefaultOutputPath = "video_split_temp"

DefaultOutputPath ...

View Source
var DefaultProbeName = "ffprobe"

DefaultProbeName ...

View Source
var DefaultProcessCore = ProcessH264CPU

DefaultProcessCore ...

View Source
var DefaultScale = Scale720P

DefaultScale ...

View Source
var DefaultSegmentFileName = "media-%05d.ts"

DefaultSegmentFileName ...

View Source
var DefaultSlice = true

DefaultSlice ...

Functions

func Args

func Args(s ...string) string

Args ...

func Err

func Err(e error, msg string) error

Err ...

func IsMedia added in v0.0.26

func IsMedia(format *StreamFormat) bool

IsMedia ...

func IsPicture added in v0.0.26

func IsPicture(name string) bool

IsPicture ...

func IsVideo added in v0.0.26

func IsVideo(filename string) bool

IsVideo ...

func LogError

func LogError(err error) bool

LogError ...

func OptimizeWithFormat

func OptimizeWithFormat(c *Config, sfmt *StreamFormat) (e error)

OptimizeWithFormat ...

func RegisterLogger

func RegisterLogger(logger extlog.Logger)

RegisterLogger ...

func ScaleValue

func ScaleValue(scale Scale) int64

ScaleValue ...

Types

type Command

type Command struct {
	// contains filtered or unexported fields
}

Command ...

func NewCommand

func NewCommand(name string) *Command

NewCommand ...

func (*Command) BinPath

func (c *Command) BinPath() string

BinPath ...

func (*Command) Message

func (c *Command) Message(f func(message string))

Message ...

func (*Command) Run

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

Run ...

func (*Command) RunContext

func (c *Command) RunContext(ctx context.Context, args string) (e error)

RunContext ...

type CommandRunner

type CommandRunner interface {
	Message(func(message string))
	Run(s string) (string, error)
	RunContext(ctx context.Context, s string) (e error)
}

CommandRunner ...

type Config

type Config struct {
	LogOutput         bool
	VideoFormat       string
	AudioFormat       string
	Scale             Scale
	ProcessCore       string
	BitRate           int64
	OptimizeBitRate   bool
	FrameRate         float64
	OptimizeFrameRate bool
	OutputPath        string //output path
	OutputName        string
	M3U8Name          string
	SegmentFileName   string
	HLSTime           int
	KeyOutput         bool
	Slice             bool
	KeyPath           string
	// contains filtered or unexported fields
}

Config ...

func DefaultConfig

func DefaultConfig() *Config

DefaultConfig ...

func (*Config) Action

func (c *Config) Action() error

Action ...

func (*Config) ActionOutput

func (c *Config) ActionOutput() string

ActionOutput ...

func (*Config) ConfigOptions added in v0.0.21

func (c *Config) ConfigOptions() ConfigOptions

ConfigOptions ...

func (*Config) CryptoInfo

func (c *Config) CryptoInfo() string

CryptoInfo ...

func (*Config) ProcessID

func (c *Config) ProcessID() string

ProcessID ...

func (*Config) ProcessPath

func (c *Config) ProcessPath() string

ProcessPath ...

func (*Config) SaveKey

func (c *Config) SaveKey() error

SaveKey ...

func (*Config) SetCrypt

func (c *Config) SetCrypt(crypto *Crypto)

SetCrypt ...

type ConfigOptions

type ConfigOptions func(cfg *Config)

ConfigOptions ...

type Crypto

type Crypto struct {
	KeyInfoPath string
	Key         string
	KeyPath     string
	UseIV       bool
	IV          string
	URL         string
	// contains filtered or unexported fields
}

Crypto ...

func GenerateCrypto

func GenerateCrypto(ssl *OpenSSL, useIV bool) *Crypto

GenerateCrypto ...

func GenerateNewKey added in v0.0.21

func GenerateNewKey(path string, iv bool) (*Crypto, error)

GenerateNewKey ...

func LoadCrypto

func LoadCrypto(path string) (c *Crypto)

LoadCrypto ...

func (*Crypto) Error

func (c *Crypto) Error() error

Error ...

func (*Crypto) SaveKey

func (c *Crypto) SaveKey() error

SaveKey ...

func (*Crypto) SaveKeyInfo

func (c *Crypto) SaveKeyInfo() error

SaveKeyInfo ...

type CutOut

type CutOut struct {
	StartTime string
	EndTime   string
}

CutOut ...

type FFMpeg

type FFMpeg struct {
	// contains filtered or unexported fields
}

FFMpeg ...

func NewFFMpeg

func NewFFMpeg(opts ...ConfigOptions) *FFMpeg

NewFFMpeg ...

func (*FFMpeg) HandleMessage

func (ff *FFMpeg) HandleMessage(msg func(s string))

HandleMessage ...

func (FFMpeg) Name

func (ff FFMpeg) Name() string

Name ...

func (FFMpeg) ProcessID added in v0.0.28

func (ff FFMpeg) ProcessID() string

ProcessID ...

func (*FFMpeg) Run

func (ff *FFMpeg) Run(ctx context.Context, input string) (e error)

Run ...

func (FFMpeg) RunCommandString added in v0.0.25

func (ff FFMpeg) RunCommandString() string

RunCommandString ...

func (*FFMpeg) Version

func (ff *FFMpeg) Version() (string, error)

Version ...

type FFProbe

type FFProbe struct {
	// contains filtered or unexported fields
}

FFProbe ...

func NewFFProbe

func NewFFProbe() *FFProbe

NewFFProbe ...

func (*FFProbe) Name

func (ff *FFProbe) Name() string

Name ...

func (*FFProbe) StreamFormat

func (ff *FFProbe) StreamFormat(file string) (*StreamFormat, error)

StreamFormat ...

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 (*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 ...

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 MpegOption

type MpegOption struct {
	Debug  bool
	Config *Config
}

MpegOption ...

type OpenSSL

type OpenSSL struct {
	// contains filtered or unexported fields
}

OpenSSL ...

func NewOpenSSL

func NewOpenSSL() *OpenSSL

NewOpenSSL ...

func (*OpenSSL) Base64

func (ssl *OpenSSL) Base64(size int) string

Base64 ...

func (*OpenSSL) Hex

func (ssl *OpenSSL) Hex(size int) string

Hex ...

func (*OpenSSL) Run

func (ssl *OpenSSL) Run(args string) (string, error)

Run ...

type Scale

type Scale int

Scale ...

const (
	ScaleNone  Scale = -1
	Scale480P  Scale = 0
	Scale720P  Scale = 1
	Scale1080P Scale = 2
	Scale2160P Scale = 3
	Scale3840P Scale = 4
)

Scale ...

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 (*StreamFormat) Audio

func (f *StreamFormat) Audio() *Stream

Audio ...

func (*StreamFormat) IsVideo

func (f *StreamFormat) IsVideo() bool

IsVideo ...

func (*StreamFormat) Video

func (f *StreamFormat) Video() *Stream

Video ...

type StreamTags

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

StreamTags ...

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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