mirror of
https://github.com/Schmenn/discord-exploits.git
synced 2024-12-22 20:45:32 +00:00
cee058edea
[^] /exploits | removed ioutil as it is deprecated [^] /modules/transcode.go | removed annoying ffmpeg output [^] go.mod | changed to go 1.16 [^] exploits.go | removed comment
31 lines
690 B
Go
31 lines
690 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
|
|
}
|