discord-exploits/modules/transcode.go

35 lines
747 B
Go
Raw Normal View History

package modules
import (
"fmt"
"os/exec"
2021-01-25 09:52:39 +00:00
"strings"
)
//Transcode transcodes videos and images
func Transcode(input string, to string) string {
path := CheckForFFmpeg()
output := CreateName(to)
2021-01-25 09:52:39 +00:00
if strings.HasSuffix(input, ".ogg") || strings.HasSuffix(input, ".mp3") || strings.HasSuffix(input, ".m4a") {
out, err := exec.Command(path, "-i", input, "-ar", "44100", "-y", "-c:a", "libvorbis", output).CombinedOutput()
Check(err)
fmt.Println("temporarily saving transcoded file to " + output)
fmt.Println(string(out))
return output
}
out, err := exec.Command(path, "-i", input, output).CombinedOutput()
Check(err)
fmt.Println("temporarily saving transcoded file to " + output)
fmt.Println(string(out))
return output
}