Created
April 23, 2017 15:44
-
-
Save peterhellberg/7ec4bfc5d27a592c58aca9aa1af7955b to your computer and use it in GitHub Desktop.
FFmpeg from Go usage example
This file contains hidden or 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 ( | |
"os/exec" | |
) | |
func newCmd(imageFile, audioFile, outFile string) *exec.Cmd { | |
return exec.Command("ffmpeg", | |
"-r", "1", | |
"-loop", "1", | |
"-i", imageFile, | |
"-i", audioFile, | |
"-acodec", "copy", | |
"-r", "1", | |
"-shortest", "-vf", | |
"scale=1280:720", | |
outFile, | |
) | |
} | |
func main() { | |
cmd := newCmd("ep1.jpg", "ep1.wav", "ep1.flv") | |
cmd.Run() | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Example with flag parsing, and output on error