Skip to content

Latest commit

 

History

History
77 lines (57 loc) · 1.25 KB

README.md

File metadata and controls

77 lines (57 loc) · 1.25 KB

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