How to using golang create a webm video?

With the help of which such realize, in what direction to dig?
Program in golang which creates videos in the webm format, the first 3 seconds, the background is filled with color RGB (255,0,0), 3 to 6, RGB(0,255,0) and from 6 to 9 seconds: RGB(0,0,255).
How is it possible to do what libraries you can use?
March 23rd 20 at 19:36
1 answer
March 23rd 20 at 19:38
So. The system must be installed the command line tool ffmpeg.

Click to reveal code
package main

import (
"io"
"os"
"os/exec"
"strings"
)

func main() {
 resulution := "640x480" // video Resolution
 framerate := "1" // frame rate, here we have enough of 1 frame per second
 outfile := "out.webm" // File to which to write the extension will set its format
 color1 := "0xFF0000" // RGB (255,0,0)
 color2 := "0x00FF00" // RGB (0,255,0)
 color3 := "0x0000FF" // RGB (0,0,255)

//////////////////////////////
 filtergraph := []string{
 "color=c=" + color1 + ":size=" + resulution + ":duration=3:s=qcif:r=" + framerate + " [v1]",
 "color=c=" + color2 + ":size=" + resulution + ":duration=3:s=qcif:r=" + framerate + " [v2]",
 "color=c=" + color3 + ":size=" + resulution + ":duration=3:s=qcif:r=" + framerate + " [v3]",
 `[v1] [v2] [v3] concat=n=3 [v]`,
}

 allOptions := []string{
 "-filter_complex", strings.Join(filtergraph, ";"),
 "-map", "[v]",
 "-threads", "0", "-y", outfile,
}

 RunCmd("ffmpeg", allOptions...)
}

ReadAndPrint func(r io.Reader) {
 io.Copy(os.Stdout, r)
}

func RunCmd(name string, args ...string) {
 cmd := exec.Command(name, args...)
 stdout, err := cmd.StdoutPipe()
 if err != nil {
panic(err)
}
 stderr, err := cmd.StderrPipe()
 if err != nil {
panic(err)
}

 go ReadAndPrint(stdout)
 go ReadAndPrint(stderr)

 err = cmd.Run()
 if err != nil {
panic(err)
}
}

Find more questions by tags VideoGo