aac

package module
v0.0.0-...-ef1e765 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 19, 2023 License: Apache-2.0 Imports: 6 Imported by: 6 modules, 5 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

aac-go

Build Status GoDoc Go Report Card

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

Installation

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

Examples

See micgrab example.

Usage

package main

import (
	"bytes"
	"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 = os.WriteFile("test.aac", buf.Bytes(), 0644)
	if err != nil {
		panic(err)
	}
}

More

For H.264 encoder see x264-go.

Documentation

Overview

Package aac provides AAC codec encoder based on VisualOn AAC encoder library.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Encoder

type Encoder struct {
	// contains filtered or unexported fields
}

Encoder type.

func NewEncoder

func NewEncoder(w io.Writer, opts *Options) (*Encoder, error)

NewEncoder returns new AAC encoder.

func (*Encoder) Close

func (e *Encoder) Close() error

Close closes encoder.

func (*Encoder) Encode

func (e *Encoder) Encode(r io.Reader) error

Encode encodes data from reader.

type Options

type Options struct {
	// Audio file sample rate
	SampleRate int
	// Encoder bit rate in bits/sec
	BitRate int
	// Number of channels on input (1,2)
	NumChannels int
}

Options represent encoding options.

Directories

Path Synopsis
Package aacenc implements cgo bindings for VisualOn AAC encoder library.
Package aacenc implements cgo bindings for VisualOn AAC encoder library.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
⌂ 换网址