ffmpeg

package module
v0.0.0-...-31b720a Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2021 License: MIT Imports: 10 Imported by: 0

README

Библиотека для использования FFmpeg в Golang

Зависимости

  • ffmpeg
  • go (^1.16.3)

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultOptionsIGeneral = OptsInGeneral{
	LogLevel:        []string{},
	Analyzeduration: 10000000,
	Probesize:       8000000,
}
View Source
var DefaultOptionsOGeneral = OptsOutGeneral{
	VCodec: "copy",
}

Functions

This section is empty.

Types

type FFmpeg

type FFmpeg struct {
	BinPath string
	Report  report
	// contains filtered or unexported fields
}

func New

func New() *FFmpeg

func (*FFmpeg) DelWorker

func (ff *FFmpeg) DelWorker(key string)

func (*FFmpeg) GetWorker

func (ff *FFmpeg) GetWorker(key string) (*Worker, bool)

func (*FFmpeg) RunOnceWorker

func (f *FFmpeg) RunOnceWorker(files ...OptionIO) error

func (*FFmpeg) SetWorker

func (ff *FFmpeg) SetWorker(key string, files ...OptionIO) (*Worker, error)

type OptionIO

type OptionIO interface {
	String() string
}

type OptsInGeneral

type OptsInGeneral struct {
	// See: https://www.ffmpeg.org/ffmpeg.html#Generic-options
	LogLevel []string // option -loglevel

	// See: https://ffmpeg.org/ffmpeg-formats.html#toc-Format-Options
	Analyzeduration int      // option -analyzeduration
	Probesize       int      // option -probesize
	MaxProbePackets int      // option -max_probe_packets
	Packetsize      int      // option -probesize
	FFlags          []string // option -fflags

	// See: https://ffmpeg.org/ffmpeg.html#toc-Audio-Options
	Audio bool // option -an

	Framerate int    // option -framerate
	VideoSize string // option -video_size
	Start     string // option -ss
}

OptsInGeneral - general input 'file' options.

func (OptsInGeneral) String

func (o OptsInGeneral) String() string

type OptsInMp4

type OptsInMp4 struct {
	File string // option -i

	// Set general input "file" options.
	General *OptsInGeneral
}

OptsInMp4 - options for mp4 input file.

func (OptsInMp4) String

func (o OptsInMp4) String() string

type OptsInRTSP

type OptsInRTSP struct {
	// See: https://www.ffmpeg.org/ffmpeg-protocols.html#toc-rtsp
	InitialPause      bool     // option -initial_pause
	RTSPTransport     string   // option -rtsp_transport
	RTSPFlags         []string // option -rtsp_flags
	AllowedMediaTypes []string // option -allowed_media_types
	MinPort           int      // option -min_port
	MaxPort           int      // option -max_port
	Timeout           int      // option -timeout
	RecorderQueueSize int      // option -recorder_queue_size
	Stimeout          int      // option -stimeout
	UserAgent         string   // option -user-agent
	File              string   // option -i

	// Set general input "file" options.
	General *OptsInGeneral
}

OptsInRTSP - options for RTSP input file.

func (OptsInRTSP) String

func (o OptsInRTSP) String() string

type OptsOutGeneral

type OptsOutGeneral struct {
	VCodec         string   // option -c:v
	VBitrate       string   // option -b:v
	VFilter        string   // option -vf
	Bufsize        string   // option -bufisze
	Audio          bool     // option -an
	Scaling        string   // option -s
	SwsFlags       []string // option -sws_flags
	Flags          []string // option -flags
	Preset         string   // option -preset
	Tune           string   // option -tune
	FPS            int      // option -r
	Gop            int      // option -g
	Vsync          string   // option -vsync
	ForceKeyFrames string   // option -force_key_frames
	KeyintMin      int      // option -keyint_min
	VProfile       string   // option -profile
	Level          string   // option -level
	MovFlags       []string // option -movflags
	Start          string   // option -ss
	CRF            int      // option -crf
	Time           string   // option -t
}

OptionsOGeneral - general output 'file' options.

See: https://www.ffmpeg.org/ffmpeg-scaler.html#toc-Scaler-Options

func (OptsOutGeneral) String

func (o OptsOutGeneral) String() string

type OptsOutHLS

type OptsOutHLS struct {
	HLSInitTime          int      // option -hls_init_time
	HLSTime              int      // option -hls_time
	HLSListSize          int      // option -hls_list_size
	HLSDeleteThreshold   int      // option -hls_delete_threshold
	HLSTsOptions         []string // option -hls_ts_options
	HLSWrap              int      // option -hls_wrap
	HLSStartNumberSource string   // option -hls_start_number_source
	StartNumber          int      // option -start_number
	HLSAllowCache        bool     // option -hls_allow_cache
	HLSBaseURL           string   // option -hls_base_url
	HLSSegmentFilename   string   // option -hls_segment_filename
	UseLocaltime         bool     // option -use_localtime
	Strftime             bool     // option -strftime
	UseLocaltimeMkdir    bool     // option -use_localtime_mkdir
	StrftimeMkdir        bool     // option -strftime_mkdir
	HLSKeyInfoFile       string   // option -hls_key_info_file
	HLSEnc               string   // option -hls_enc
	HLSEncKey            string   // option -hls_enc_key
	HLSEncKeyURL         string   // option -hls_enc_key_url
	HLSEncIv             string   // option -hls_enc_iv
	HLSSegmentType       string   // option -hls_segment_type
	HLSFMP4InitFilename  string   // option -hls_fmp4_init_filename
	HLSFMP4InitResend    string   // option -hls_fmp4_init_resend
	HLSFlags             []string // option -hls_flags
	HLSPlaylistType      string   // option -hls_segment_type
	Method               string   // option -method
	HTTPUserAgent        string   // option -http_user_agent
	VarStreamMap         string   // option -var_stream_map
	CCStreamMap          string   // option -cc_stream_map
	MasterPlName         string   // option -master_pl_name
	MasterPlPublishRate  int      // option -master_pl_publish_rate
	HTTPPersistent       string   // option -http_persistent
	Timeout              int      // option -timeout
	IgnoreIoErrors       bool     // option -ignore_io_errors
	Headers              string   // option -header

	File string // output file

	General *OptsOutGeneral // general output options
}

OptsOutHLS - options for HLS output file. See: https://ffmpeg.org/ffmpeg-formats.html#toc-Options-6

func (OptsOutHLS) String

func (o OptsOutHLS) String() string

type OptsOutMp4

type OptsOutMp4 struct {
	File string

	// Set general input "file" options.
	General *OptsOutGeneral
}

func (OptsOutMp4) String

func (o OptsOutMp4) String() string

type OptsOutSegment

type OptsOutSegment struct {
	IncrementTc                  bool              // option -increment_tc
	ReferenceStream              string            // option -reference_stream
	SegmentFormat                string            // option -segment_format
	SegmentFormatOptions         map[string]string // option -segment_format_options
	SegmentList                  string            // option -segment_list
	SegmentListFlags             []string          // option -segment_list_flags
	SegmentListSize              int               // option -segment_list_size
	SegmentListEntryPrefix       string            // option -segment_list_entry_prefix
	SegmentListType              string            // option -segment_list_type
	SegmentTime                  int               // option -segment_tiem
	SegmentAtClockTime           bool              // option -segment_atclocktime
	SegmentClockTimeOffset       int               // option -segment_clocktime_offset
	SegmentClockTimeWrapDuration int               // option -segment_clocktime_wrap_duration
	SegmentTimeDelta             int               // option -segment_time_delta
	SegmentTimes                 []int             // option -segment_times
	SegmentFrames                []int             // option -segment_frames
	SegmentWrap                  int               // option -segment_wrap
	SegmentStartNumber           int               // option -segment_start_number
	Strftime                     bool              // option -strftime
	BreakNonKeyframes            bool              // option -break_non_keyframes
	ResetTimestamps              bool              // option -reset_timestamps
	InitialOffset                int               // option -initial_offset
	WriteEmptySegments           bool              // option -write_empty_segments

	File string // output file

	General *OptsOutGeneral
}

OptsOutSegment - options for segments format output file. See: https://ffmpeg.org/ffmpeg-formats.html#toc-Options-12

func (OptsOutSegment) String

func (o OptsOutSegment) String() string

type Worker

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

func (*Worker) Cron

func (w *Worker) Cron(timeout time.Duration)

FFmpeg process checker..

func (*Worker) IsActive

func (w *Worker) IsActive() bool

func (*Worker) Run

func (w *Worker) Run() error

Run starts the specified worker and waits for it to complete.

func (*Worker) Start

func (w *Worker) Start() error

Start starts the specified worker but does not wait for it to complete.

func (*Worker) Stop

func (w *Worker) Stop() error

Jump to

Keyboard shortcuts

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