Take control over your live stream video by running it yourself. Streaming + chat out of the box.
HTML activitypubbroadcastingchatdecentralizedfederationfediversegolanghacktoberfesthlslivelivestreamowncastrtmpself-hostedstreaming-videovideo
Support default path of ffmpeg and not needing to specify it in the config
Gabe Kangas86987ea263d6
diff --git a/config-example.yaml b/config-example.yamlindex 33612938dd..9000393387 100644--- a/config-example.yaml+++ b/config-example.yaml@@ -1,6 +1,5 @@publicHLSPath: webroot/hlsprivateHLSPath: hls-ffmpegPath: /usr/bin/ffmpegwebServerPort: 8080instanceDetails:diff --git a/config/config.go b/config/config.goindex 9116ccd5dd..35e0f3c69c 100644--- a/config/config.go+++ b/config/config.go@@ -2,8 +2,9 @@ package configimport ("errors"- "fmt""io/ioutil"+ "os/exec"+ "strings""github.com/gabek/owncast/utils"log "github.com/sirupsen/logrus"@@ -132,19 +133,26 @@ func (c *config) verifySettings() error {}}- // if !fileExists(config.PrivateHLSPath) {- // os.MkdirAll(path.Join(config.PrivateHLSPath, strconv.Itoa(0)), 0777)- // }+ return nil+}- // if !fileExists(config.PublicHLSPath) {- // os.MkdirAll(path.Join(config.PublicHLSPath, strconv.Itoa(0)), 0777)- // }+func (c *config) GetFFMpegPath() string {+ if c.FFMpegPath != "" {+ return c.FFMpegPath+ }- if !utils.DoesFileExists(c.FFMpegPath) {- return fmt.Errorf("ffmpeg does not exist at: %s", c.FFMpegPath)+ cmd := exec.Command("which", "ffmpeg")+ out, err := cmd.CombinedOutput()+ if err != nil {+ log.Panicln("Unable to determine path to ffmpeg. Please specify it in the config file.")}- return nil+ path := strings.TrimSpace(string(out))++ // Memoize it for future access+ c.FFMpegPath = path++ return path}//Load tries to load the configuration filediff --git a/core/ffmpeg/thumbnailGenerator.go b/core/ffmpeg/thumbnailGenerator.goindex cd5ecde130..388458a8ba 100644--- a/core/ffmpeg/thumbnailGenerator.go+++ b/core/ffmpeg/thumbnailGenerator.go@@ -72,7 +72,7 @@ func fireThumbnailGenerator(chunkPath string, variantIndex int) error {mostRecentFile := path.Join(framePath, names[0])thumbnailCmdFlags := []string{- config.Config.FFMpegPath,+ config.Config.GetFFMpegPath(),"-y", // Overwrite file"-threads 1", // Low priority processing"-t 1", // Pull from frame 1diff --git a/core/ffmpeg/transcoder.go b/core/ffmpeg/transcoder.goindex 3b9bc872b4..ff26e4a740 100644--- a/core/ffmpeg/transcoder.go+++ b/core/ffmpeg/transcoder.go@@ -104,7 +104,7 @@ func (t *Transcoder) getString() string {ffmpegFlags := []string{"cat", t.input, "|",- config.Config.FFMpegPath,+ config.Config.GetFFMpegPath(),"-hide_banner","-i pipe:",t.getVariantsString(),