Skip to content

Commit

Permalink
change ffmpeg module
Browse files Browse the repository at this point in the history
  • Loading branch information
dpolakovics committed Nov 4, 2024
1 parent 8f84111 commit 0122ce0
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 9 deletions.
23 changes: 23 additions & 0 deletions internal/logic/ffmpeg.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package logic

import (
"fmt"
"os/exec"
"runtime"
ffstatic_windows_amd64 "github.com/go-ffstatic/windows-amd64"

Check failure on line 7 in internal/logic/ffmpeg.go

View workflow job for this annotation

GitHub Actions / build

"github.com/go-ffstatic/windows-amd64" imported as ffstatic_windows_amd64 and not used
)

func findFFmpeg() (string, error) {

path, err := exec.LookPath("ffmpeg")
if err == nil {
return path, nil
}

// Add platform-specific fallback paths
if runtime.GOOS == "windows" {
return ffstatic_darwin_amd64.FFmpegPath(), nil

Check failure on line 19 in internal/logic/ffmpeg.go

View workflow job for this annotation

GitHub Actions / build

undefined: ffstatic_darwin_amd64
}

return "", fmt.Errorf("FFmpeg not found")
}
6 changes: 0 additions & 6 deletions internal/logic/ffmpeg_windows.go

This file was deleted.

6 changes: 3 additions & 3 deletions internal/logic/sync-stereo.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,11 @@ func combineStereoFiles(folder1 string, folder2 string, outputFolder string, pro
return fmt.Errorf("the number of audio files in the two folders must be the same")
}

ffmpegPath, err := findFFmpeg()

for index, file := range files1 {
// Construct FFmpeg command
cmd := exec.Command("ffmpeg",
cmd := exec.Command(ffmpegPath,
"-i", file,
"-i", files2[index],
"-filter_complex", "[0:a][1:a]amerge=inputs=2,pan=stereo|c0<c0+c2|c1<c1+c3[a]",
Expand All @@ -39,8 +41,6 @@ func combineStereoFiles(folder1 string, folder2 string, outputFolder string, pro
}
}



progress.SetValue(1.0)
return nil
}

0 comments on commit 0122ce0

Please sign in to comment.