Support default path of ffmpeg and not needing to specify it in the config
This commit is contained in:
parent
5b0eb8834f
commit
51e2e68017
@ -1,6 +1,5 @@
|
|||||||
publicHLSPath: webroot/hls
|
publicHLSPath: webroot/hls
|
||||||
privateHLSPath: hls
|
privateHLSPath: hls
|
||||||
ffmpegPath: /usr/bin/ffmpeg
|
|
||||||
webServerPort: 8080
|
webServerPort: 8080
|
||||||
|
|
||||||
instanceDetails:
|
instanceDetails:
|
||||||
|
@ -2,8 +2,9 @@ package config
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
|
"os/exec"
|
||||||
|
"strings"
|
||||||
|
|
||||||
"github.com/gabek/owncast/utils"
|
"github.com/gabek/owncast/utils"
|
||||||
log "github.com/sirupsen/logrus"
|
log "github.com/sirupsen/logrus"
|
||||||
@ -132,19 +133,26 @@ func (c *config) verifySettings() error {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// if !fileExists(config.PrivateHLSPath) {
|
return nil
|
||||||
// os.MkdirAll(path.Join(config.PrivateHLSPath, strconv.Itoa(0)), 0777)
|
}
|
||||||
// }
|
|
||||||
|
|
||||||
// if !fileExists(config.PublicHLSPath) {
|
func (c *config) GetFFMpegPath() string {
|
||||||
// os.MkdirAll(path.Join(config.PublicHLSPath, strconv.Itoa(0)), 0777)
|
if c.FFMpegPath != "" {
|
||||||
// }
|
return c.FFMpegPath
|
||||||
|
|
||||||
if !utils.DoesFileExists(c.FFMpegPath) {
|
|
||||||
return fmt.Errorf("ffmpeg does not exist at: %s", c.FFMpegPath)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
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.")
|
||||||
|
}
|
||||||
|
|
||||||
|
path := strings.TrimSpace(string(out))
|
||||||
|
|
||||||
|
// Memoize it for future access
|
||||||
|
c.FFMpegPath = path
|
||||||
|
|
||||||
|
return path
|
||||||
}
|
}
|
||||||
|
|
||||||
//Load tries to load the configuration file
|
//Load tries to load the configuration file
|
||||||
|
@ -72,7 +72,7 @@ func fireThumbnailGenerator(chunkPath string, variantIndex int) error {
|
|||||||
mostRecentFile := path.Join(framePath, names[0])
|
mostRecentFile := path.Join(framePath, names[0])
|
||||||
|
|
||||||
thumbnailCmdFlags := []string{
|
thumbnailCmdFlags := []string{
|
||||||
config.Config.FFMpegPath,
|
config.Config.GetFFMpegPath(),
|
||||||
"-y", // Overwrite file
|
"-y", // Overwrite file
|
||||||
"-threads 1", // Low priority processing
|
"-threads 1", // Low priority processing
|
||||||
"-t 1", // Pull from frame 1
|
"-t 1", // Pull from frame 1
|
||||||
|
@ -104,7 +104,7 @@ func (t *Transcoder) getString() string {
|
|||||||
|
|
||||||
ffmpegFlags := []string{
|
ffmpegFlags := []string{
|
||||||
"cat", t.input, "|",
|
"cat", t.input, "|",
|
||||||
config.Config.FFMpegPath,
|
config.Config.GetFFMpegPath(),
|
||||||
"-hide_banner",
|
"-hide_banner",
|
||||||
"-i pipe:",
|
"-i pipe:",
|
||||||
t.getVariantsString(),
|
t.getVariantsString(),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user