Take control over your live stream video by running it yourself. Streaming + chat out of the box.
HTML activitypubbroadcastingchatdecentralizedfederationfediversegolanghacktoberfesthlslivelivestreamowncastrtmpself-hostedstreaming-videovideo
Do not perform ffmpeg location logic in defaults
Gabe Kangasaf63234bf53e
diff --git a/config/config.go b/config/config.goindex 49d5c4a10d..7b866a4a9f 100644--- a/config/config.go+++ b/config/config.go@@ -3,6 +3,8 @@ package configimport ("errors""io/ioutil"+ "os/exec"+ "strings""github.com/owncast/owncast/utils"log "github.com/sirupsen/logrus"@@ -184,7 +186,23 @@ func (c *config) GetFFMpegPath() string {return c.FFMpegPath}- return _default.FFMpegPath+ // First look to see if ffmpeg is in the current working directory+ localCopy := "./ffmpeg"+ hasLocalCopyError := verifyFFMpegPath(localCopy)+ if hasLocalCopyError == nil {+ // No error, so all is good. Use the local copy.+ return localCopy+ }++ cmd := exec.Command("which", "ffmpeg")+ out, err := cmd.CombinedOutput()+ if err != nil {+ log.Debugln("Unable to determine path to ffmpeg. Please specify it in the config file.")+ }++ path := strings.TrimSpace(string(out))++ return path}func (c *config) GetYPServiceHost() string {diff --git a/config/defaults.go b/config/defaults.goindex a10b4bd001..251800a56d 100644--- a/config/defaults.go+++ b/config/defaults.go@@ -1,14 +1,8 @@package config-import (- "os/exec"- "strings"-)-func getDefaults() config {defaults := config{}defaults.WebServerPort = 8080- defaults.FFMpegPath = getDefaultFFMpegPath()defaults.VideoSettings.ChunkLengthInSeconds = 4defaults.Files.MaxNumberInPlaylist = 5defaults.YP.Enabled = false@@ -25,23 +19,3 @@ func getDefaults() config {return defaults}--func getDefaultFFMpegPath() string {- // First look to see if ffmpeg is in the current working directory- localCopy := "./ffmpeg"- hasLocalCopyError := verifyFFMpegPath(localCopy)- if hasLocalCopyError == nil {- // No error, so all is good. Use the local copy.- return localCopy- }-- cmd := exec.Command("which", "ffmpeg")- out, err := cmd.CombinedOutput()- if err != nil {- panic("Unable to determine path to ffmpeg. Please specify it in the config file.")- }-- path := strings.TrimSpace(string(out))-- return path-}