mirror of
https://github.com/xfrr/goffmpeg.git
synced 2025-10-08 09:20:08 +08:00

* cleanup readme & examples * upgrade go version * add makefile with basic commands * add e2e test * add gha * update .gitignore
35 lines
592 B
Go
35 lines
592 B
Go
package main
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
"github.com/xfrr/goffmpeg/transcoder"
|
|
)
|
|
|
|
const (
|
|
inputPath = "../fixtures/input.3gp"
|
|
outputPath = "../test_results/hls-output.mp4"
|
|
keyinfoPath = "keyinfo"
|
|
)
|
|
|
|
func main() {
|
|
trans := new(transcoder.Transcoder)
|
|
|
|
err := trans.Initialize(inputPath, outputPath)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
|
|
trans.MediaFile().SetVideoCodec("libx264")
|
|
trans.MediaFile().SetHlsSegmentDuration(4)
|
|
trans.MediaFile().SetEncryptionKey(keyinfoPath)
|
|
|
|
done := trans.Run(true)
|
|
progress := trans.Output()
|
|
for p := range progress {
|
|
fmt.Println(p)
|
|
}
|
|
|
|
fmt.Println(<-done)
|
|
}
|