call ffmpeg directly as a command and remove ffmpeg-go dependency

This allows us to send interrupt signals and kill the process when ctrl+c is pressed.

Added `copy` and `None` encoder options to copy the video/audio streams without modifications
and to allow the removal of audio from video files.

Updated to Go 1.23
This commit is contained in:
2024-12-18 23:05:03 +02:00
parent ce907e1079
commit 24924e0bd1
7 changed files with 90 additions and 96 deletions
+4 -5
View File
@@ -7,22 +7,22 @@ import (
"math/rand"
"net"
"os"
"os/exec"
"path"
"regexp"
"strconv"
"strings"
"time"
tea "github.com/charmbracelet/bubbletea"
ffmpeg "github.com/u2takey/ffmpeg-go"
)
func getProgressSocket(inFileName string, teaP *tea.Program) string {
a, err := ffmpeg.Probe(inFileName)
cmd := exec.Command("ffprobe", "-show_format", "-show_streams", "-of", "json", inFileName)
probe, err := cmd.Output()
if err != nil {
panic(err)
}
totalDuration, err := probeDuration(a)
totalDuration, err := probeDuration(string(probe))
if err != nil {
panic(err)
}
@@ -33,7 +33,6 @@ func getProgressSocket(inFileName string, teaP *tea.Program) string {
func TempSock(totalDuration float64, teaP *tea.Program) string {
// serve
rand.Seed(time.Now().Unix())
sockFileName := path.Join(os.TempDir(), fmt.Sprintf("%d_sock", rand.Int()))
l, err := net.Listen("unix", sockFileName)
if err != nil {