discord-exploits/modules/transcode.go
2021-05-19 00:29:40 -07:00

31 lines
688 B
Go

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