structural improvements

This commit is contained in:
2026-09-06 20:33:15 +02:00
parent d95b0d8b4a
commit 887a20e38a
5 changed files with 91 additions and 75 deletions
+37
View File
@@ -0,0 +1,37 @@
package convertVideo
import (
"fmt"
"os"
"os/exec"
"path/filepath"
)
func ConvertVideo(path string) {
out := path[:len(path)-len(filepath.Ext(path))] + ".mp4"
cmd := exec.Command("ffmpeg",
"-i", "input.mp4",
"-c:v", "libx264",
"-crf", "23",
"-preset", "medium",
"-c:a", "aac",
"-b:a", "128k",
out,
)
cmd.Stderr = cmd.Stdout
_, err := cmd.CombinedOutput()
if err != nil {
fmt.Printf("Error converting %s: %v\n", path, err)
return
}
if err := os.Remove(path); err != nil {
fmt.Printf("Converted %s -> %s, but failed to delete original: %v\n", path, out, err)
return
}
fmt.Printf("Converted %s -> %s (original deleted)\n", path, out)
}