Golang transcoder using ffmpeg
- HTTP Live Streaming
- MPEG DASH
- Golang 1.14
- ffmpeg
Generate HLS files + playlist from a mov file.
package main
import (
"os/exec"
"github.com/azanium/go-transcoder/hls"
)
func main() {
srcPath := "./Love.mov"
targetPath := "hls/"
resOptions := []string{"480p", "720p"}
ffmpeg, err := exec.LookPath("ffmpeg")
if err != nil {
panic(err)
}
variants, _ := hls.GenerateHLSVariant(resOptions, "")
hls.GeneratePlaylist(variants, targetPath, "")
for _, res := range resOptions {
hls.GenerateHLS(ffmpeg, srcPath, targetPath, res)
}
}
MIT licensed. See the LICENSE file for details.