diff --git a/ffmpeg/ffmpeg.go b/ffmpeg/ffmpeg.go index b3c4b445..05135116 100644 --- a/ffmpeg/ffmpeg.go +++ b/ffmpeg/ffmpeg.go @@ -30,6 +30,7 @@ type FFmpeg interface { } type ProcessConfig struct { + Binary string // Override the default binary Reconnect bool // Whether to reconnect ReconnectDelay time.Duration // Duration until next reconnect StaleTimeout time.Duration // Duration to wait until killing the process if there is no progress in the process @@ -150,8 +151,13 @@ func (f *ffmpeg) New(config ProcessConfig) (process.Process, error) { limitMode = process.LimitModeSoft } + binary := f.binary + if len(config.Binary) != 0 { + binary = config.Binary + } + ffmpeg, err := process.New(process.Config{ - Binary: f.binary, + Binary: binary, Args: config.Args, Reconnect: config.Reconnect, ReconnectDelay: config.ReconnectDelay, diff --git a/http/api/process.go b/http/api/process.go index ce418a9e..2563ebb2 100644 --- a/http/api/process.go +++ b/http/api/process.go @@ -169,6 +169,7 @@ type ProcessConfig struct { ID string `json:"id"` Owner string `json:"owner"` Domain string `json:"domain"` + Binary string `json:"binary"` Type string `json:"type" validate:"oneof='ffmpeg' ''" jsonschema:"enum=ffmpeg,enum="` Reference string `json:"reference"` Input []ProcessConfigIO `json:"input" validate:"required"` @@ -191,6 +192,7 @@ func (cfg *ProcessConfig) Marshal() (*app.Config, map[string]interface{}) { ID: cfg.ID, Owner: cfg.Owner, Domain: cfg.Domain, + Binary: cfg.Binary, Reference: cfg.Reference, Options: cfg.Options, Reconnect: cfg.Reconnect, @@ -283,6 +285,7 @@ func (cfg *ProcessConfig) Unmarshal(c *app.Config, metadata map[string]interface cfg.ID = c.ID cfg.Owner = c.Owner cfg.Domain = c.Domain + cfg.Binary = c.Binary cfg.Reference = c.Reference cfg.Type = "ffmpeg" cfg.Reconnect = c.Reconnect diff --git a/restream/app/process.go b/restream/app/process.go index e02cd69a..501fc811 100644 --- a/restream/app/process.go +++ b/restream/app/process.go @@ -72,6 +72,7 @@ type Config struct { Reference string Owner string Domain string + Binary string FFVersion string Input []ConfigIO Output []ConfigIO @@ -102,6 +103,7 @@ func (config *Config) Clone() *Config { Reference: config.Reference, Owner: config.Owner, Domain: config.Domain, + Binary: config.Binary, FFVersion: config.FFVersion, Reconnect: config.Reconnect, ReconnectDelay: config.ReconnectDelay, @@ -173,6 +175,7 @@ func (config *Config) Hash() []byte { b.WriteString(config.Reference) b.WriteString(config.Owner) b.WriteString(config.Domain) + b.WriteString(config.Binary) b.WriteString(config.Scheduler) b.WriteString(strings.Join(config.Options, ",")) b.WriteString(strings.Join(config.LogPatterns, ",")) diff --git a/restream/core.go b/restream/core.go index 6824f83c..01d29560 100644 --- a/restream/core.go +++ b/restream/core.go @@ -436,6 +436,7 @@ func (r *restream) load() error { } ffmpeg, err := r.ffmpeg.New(ffmpeg.ProcessConfig{ + Binary: t.config.Binary, Reconnect: t.config.Reconnect, ReconnectDelay: time.Duration(t.config.ReconnectDelay) * time.Second, StaleTimeout: time.Duration(t.config.StaleTimeout) * time.Second, @@ -619,6 +620,7 @@ func (r *restream) createTask(config *app.Config) (*task, error) { } ffmpeg, err := r.ffmpeg.New(ffmpeg.ProcessConfig{ + Binary: t.config.Binary, Reconnect: t.config.Reconnect, ReconnectDelay: time.Duration(t.config.ReconnectDelay) * time.Second, StaleTimeout: time.Duration(t.config.StaleTimeout) * time.Second,