Skip to content

Transcoding library implementation in Golang

License

Notifications You must be signed in to change notification settings

LAShZ/transcoder

 
 

Repository files navigation

Transcoder plus

Features

Ease use
Implement your own business logic around easy interfaces
Transcoding progress
Obtain progress events generated by transcoding application process

add:支持多文件输入

Download from GitLab

go get -u http://gitlab.yiban.io/we-work-go-team/transcoder-plus

Example

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)
	}
}

项目源地址

https://github.com/floostack/transcoder

About

Transcoding library implementation in Golang

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Go 100.0%