go - Golang exec.Command() error - ffmpeg command through golang -


currently working ffmpeg command edit video

ffmpeg -i "video1.ts" -c:v libx264 -crf 20 -c:a aac -strict -2 "video1-fix.ts" 

when enter in terminal, works. when try use golang exec.command() func, err response of

&{/usr/local/bin/ffmpeg [ffmpeg -i "video1.ts" -c:v libx264 -crf 20 -c:a aac -strict -2 "video1-fix.ts"] []  <nil> <nil> <nil> [] <nil> <nil> <nil> <nil> <nil> false [] [] [] [] <nil> <nil>} 

here below code

cmdarguments := []string{"-i", "\"video-1.ts\"", "-c:v", "libx264",          "-crf", "20", "-c:a", "aac", "-strict", "-2", "\"video1-fix.ts\""}  err := exec.command("ffmpeg", cmdarguments...) fmt.println(err) 

am missing command syntax? not sure why not loading videos

as @jimb says, exec.command not return error. here changed code example https://golang.org/pkg/os/exec/#command

by way dont need use "\"video-1.ts\"" - quotes shell feature.

package main  import (     "bytes"     "fmt"     "log"     "os/exec" )  func main() {     cmdarguments := []string{"-i", "video-1.ts", "-c:v", "libx264",      "-crf", "20", "-c:a", "aac", "-strict", "-2", "video1-fix.ts"}      cmd := exec.command("tr", cmdarguments...)      var out bytes.buffer     cmd.stdout = &out     err := cmd.run()     if err != nil {         log.fatal(err)     }     fmt.printf("command output: %q\n", out.string()) } 

Comments

Popular posts from this blog

python Tkinter Capturing keyboard events save as one single string -

android - InAppBilling registering BroadcastReceiver in AndroidManifest -

javascript - Z-index in d3.js -