Support a local working directory copy of ffmpeg. Closes #276
This commit is contained in:
@@ -28,6 +28,14 @@ func getDefaults() config {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func getDefaultFFMpegPath() string {
|
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")
|
cmd := exec.Command("which", "ffmpeg")
|
||||||
out, err := cmd.CombinedOutput()
|
out, err := cmd.CombinedOutput()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
package ffmpeg
|
package config
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"errors"
|
"errors"
|
||||||
@@ -6,8 +6,8 @@ import (
|
|||||||
"os"
|
"os"
|
||||||
)
|
)
|
||||||
|
|
||||||
//VerifyFFMpegPath verifies that the path exists, is a file, and is executable
|
//verifyFFMpegPath verifies that the path exists, is a file, and is executable
|
||||||
func VerifyFFMpegPath(path string) error {
|
func verifyFFMpegPath(path string) error {
|
||||||
stat, err := os.Stat(path)
|
stat, err := os.Stat(path)
|
||||||
|
|
||||||
if os.IsNotExist(err) {
|
if os.IsNotExist(err) {
|
||||||
Reference in New Issue
Block a user