- Ease use
- Implement your own business logic around easy interfaces
- Transcoding progress
- Obtain progress events generated by transcoding application process
add:支持多文件输入
go get -u http://gitlab.yiban.io/we-work-go-team/transcoder-plus
package main
import (
"log"
"transcoderplus/ffmpeg"
)
func main() {
inputformat := "mulaw"
filtercomplex := "amix=inputs=2"
audiorate := 8000
outputformat := "mp3"
overwrite := true
outputopts := ffmpeg.Options{
OutputFormat: &outputformat,
Overwrite: &overwrite,
FilterComplex: &filtercomplex,
}
inputopts := ffmpeg.Options{
OutputFormat: &inputformat,
AudioRate: &audiorate,
}
ffmpegConf := &ffmpeg.Config{
FfmpegBinPath: "ffmpegPath",
FfprobeBinPath: "ffprobePath",
ProgressEnabled: true,
}
progress, err := ffmpeg.
New(ffmpegConf).
Input("inputfile1Path").
Input("inputfile2Path").
Output("outputfile1Path").
WithOptions(outputopts).
Start(inputopts)
if err != nil {
log.Fatal(err)
}
for msg := range progress {
log.Printf("%+v", msg)
}
}