fixed double file extension

This commit is contained in:
Linrador 2025-08-08 07:23:08 +02:00
parent 100e5e6b8b
commit 596b8389fb
2 changed files with 9 additions and 2 deletions

11
main.go
View File

@ -7,6 +7,7 @@ import (
"fmt" "fmt"
"io" "io"
"net/http" "net/http"
"path/filepath"
"os" "os"
"os/exec" "os/exec"
"regexp" "regexp"
@ -77,8 +78,14 @@ func main() {
fmt.Println("❌ Aufnahmefehler:", err) fmt.Println("❌ Aufnahmefehler:", err)
} }
// MP4 umwandeln mp4Out := outputPath
mp4Out := strings.TrimSuffix(outputPath, ".ts") + ".mp4" ext := filepath.Ext(outputPath)
// Falls nicht bereits .mp4 als Endung existiert
if ext != ".mp4" {
mp4Out = strings.TrimSuffix(outputPath, ext) + ".mp4"
}
if err := exec.Command("ffmpeg", "-y", "-i", outputPath, "-c", "copy", mp4Out).Run(); err != nil { if err := exec.Command("ffmpeg", "-y", "-i", outputPath, "-c", "copy", mp4Out).Run(); err != nil {
fmt.Println("⚠️ Fehler bei Umwandlung in MP4:", err) fmt.Println("⚠️ Fehler bei Umwandlung in MP4:", err)
} else { } else {

Binary file not shown.