Skip to content

Instantly share code, notes, and snippets.

@zed-wong
Created August 8, 2021 00:26
Show Gist options
  • Save zed-wong/a85c21a86927290373ce890d22644794 to your computer and use it in GitHub Desktop.
Save zed-wong/a85c21a86927290373ce890d22644794 to your computer and use it in GitHub Desktop.
golang ffmpeg exec
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