Goffmpeg
FFMPEG wrapper written in GO which allows to obtain the progress.
Dependencies
Supported platforms
Getting started
How to transcode a media file
go get github.com/xfrr/goffmpeg
package main
import (
"github.com/carousell/goffmpeg/transcoder"
)
var inputPath = "/data/testmov"
var outputPath = "/data/testmp4.mp4"
func main() {
trans := new(transcoder.Transcoder)
err := trans.Initialize( inputPath, outputPath )
done := trans.Run(false)
err = <-done
}
How to get the transcoding progress
...
func main() {
trans := new(transcoder.Transcoder)
err := trans.Initialize( inputPath, outputPath )
done := trans.Run(true)
progress := trans.Output()
for msg := range progress {
fmt.Println(msg)
}
err = <-done
}
Progress properties
type Progress struct {
FramesProcessed string
CurrentTime string
CurrentBitrate string
Progress float64
Speed string
}
Media setters
Those options can be set before starting the transcoding.
SetAspect
SetResolution
SetVideoBitRate
SetVideoBitRateTolerance
SetVideoMaxBitrate
SetVideoMinBitRate
SetVideoCodec
SetVframes
SetFrameRate
SetAudioRate
SetSkipAudio
SetSkipVideo
SetMaxKeyFrame
SetMinKeyFrame
SetKeyframeInterval
SetAudioCodec
SetAudioBitRate
SetAudioChannels
SetBufferSize
SetThreads
SetPreset
SetTune
SetAudioProfile
SetVideoProfile
SetDuration
SetDurationInput
SetSeekTime
SetSeekTimeInput
SetSeekUsingTsInput
SetQuality
SetStrict
SetCopyTs
SetMuxDelay
SetHideBanner
SetInputPath
SetNativeFramerateInput
SetRtmpLive
SetHlsListSize
SetHlsSegmentDuration
SetHlsPlaylistType
SetHttpMethod
SetHttpKeepAlive
SetOutputPath
SetOutputFormat
Example
func main() {
trans := new(transcoder.Transcoder)
err := trans.Initialize( inputPath, outputPath )
trans.MediaFile().SetFrameRate(70)
trans.MediaFile().SetPreset("ultrafast")
done := trans.Run(true)
progress := trans.Output()
for msg := range progress {
fmt.Println(msg)
}
err = <-done
}
Building...