Created
August 8, 2021 00:26
-
-
Save zed-wong/a85c21a86927290373ce890d22644794 to your computer and use it in GitHub Desktop.
golang ffmpeg exec
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import( | |
"fmt" | |
"log" | |
"os/exec" | |
"strings" | |
) | |
func main(){ | |
f1:= "audio.wav" | |
f2:= "audio.ogx" | |
s := fmt.Sprintf("ffmpeg -i %s %s", f2, f1) | |
args := strings.Split(s, " ") | |
cmd := exec.Command(args[0], args[1:]...) | |
b, err := cmd.CombinedOutput() | |
if err !=nil{log.Println(err)} | |
fmt.Println(string(b)) | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment