Go bindings for vo-aacenc. Fork of https://github.com/aam335/aac-go
Go to file
2018-03-06 04:50:55 +01:00
aacenc Initial commit 2018-03-06 04:50:55 +01:00
examples/basic Initial commit 2018-03-06 04:50:55 +01:00
testdata Initial commit 2018-03-06 04:50:55 +01:00
.appveyor.yml Initial commit 2018-03-06 04:50:55 +01:00
.travis.yml Initial commit 2018-03-06 04:50:55 +01:00
AUTHORS Initial commit 2018-03-06 04:50:55 +01:00
COPYING Initial commit 2018-03-06 04:50:55 +01:00
encode.go Initial commit 2018-03-06 04:50:55 +01:00
encode_test.go Initial commit 2018-03-06 04:50:55 +01:00
README.md Initial commit 2018-03-06 04:50:55 +01:00

aac-go

TravisCI Build Status AppVeyor Build Status GoDoc Go Report Card

aac-go provides AAC codec encoder based on VisualOn AAC encoder library library.

Installation

go get -u github.com/gen2brain/aac-go

Example

package main

import (
	"bytes"
	"io/ioutil"
	"os"

	"github.com/gen2brain/aac-go"
	"github.com/youpy/go-wav"
)

func main() {
	file, err := os.Open("test.wav")
	if err != nil {
		panic(err)
	}

	wreader := wav.NewReader(file)
	f, err := wreader.Format()
	if err != nil {
		panic(err)
	}

	buf := bytes.NewBuffer(make([]byte, 0))

	opts := &aac.Options{}
	opts.SampleRate = int(f.SampleRate)
	opts.NumChannels = int(f.NumChannels)

	enc, err := aac.NewEncoder(buf, opts)
	if err != nil {
		panic(err)
	}

	err = enc.Encode(wreader)
	if err != nil {
		panic(err)
	}

	err = enc.Close()
	if err != nil {
		panic(err)
	}

	err = ioutil.WriteFile("test.aac", buf.Bytes(), 0644)
	if err != nil {
		panic(err)
	}
}

More

For H.264 encoder see x264-go.