jna-aac-encoder

AAC encoding capabiltiies for the JVM

License

License

Categories

Categories

JNA Development Tools Native
GroupId

GroupId

org.sheinbergon
ArtifactId

ArtifactId

jna-aac-encoder
Last Version

Last Version

0.1.6
Release Date

Release Date

Type

Type

jar
Description

Description

jna-aac-encoder
AAC encoding capabiltiies for the JVM
Project URL

Project URL

https://github.com/sheinbergon/jna-aac-encoder
Source Code Management

Source Code Management

https://github.com/sheinbergon/jna-aac-encoder

Download jna-aac-encoder

How to add to project

<!-- https://jarcasting.com/artifacts/org.sheinbergon/jna-aac-encoder/ -->
<dependency>
    <groupId>org.sheinbergon</groupId>
    <artifactId>jna-aac-encoder</artifactId>
    <version>0.1.6</version>
</dependency>
// https://jarcasting.com/artifacts/org.sheinbergon/jna-aac-encoder/
implementation 'org.sheinbergon:jna-aac-encoder:0.1.6'
// https://jarcasting.com/artifacts/org.sheinbergon/jna-aac-encoder/
implementation ("org.sheinbergon:jna-aac-encoder:0.1.6")
'org.sheinbergon:jna-aac-encoder:jar:0.1.6'
<dependency org="org.sheinbergon" name="jna-aac-encoder" rev="0.1.6">
  <artifact name="jna-aac-encoder" type="jar" />
</dependency>
@Grapes(
@Grab(group='org.sheinbergon', module='jna-aac-encoder', version='0.1.6')
)
libraryDependencies += "org.sheinbergon" % "jna-aac-encoder" % "0.1.6"
[org.sheinbergon/jna-aac-encoder "0.1.6"]

Dependencies

compile (3)

Group / Artifact Type Version
net.java.dev.jna : jna jar 5.5.0
org.apache.commons : commons-lang3 jar 3.11
com.google.code.findbugs : jsr305 jar 3.0.2

Project Modules

There are no modules declared in this project.

jna-aac-encoder

GitHub GitHub Workflow Status GitHub release (latest by date) Maven Central Codecov Codacy grade

This library provides AAC encoding capabilities for the JVM. It utilizes the FDK AAC library via JNA in order to do so.

License

Important! While this library uses LGPL-3, please see the FDK AAC license for additional information regarding re/distribution and licensing limitations.

Usage

Dependencies

Artifacts are available on maven central:

Maven

<dependency>
    <groupId>org.sheinbergon</groupId>
    <artifactId>jna-aac-encoder</artifactId>
    <version>0.1.6</version>
</dependency>

Gradle

compile 'org.sheinbergon:jna-aac-encoder:0.1.6'

Additional information

  • Single artifact containing libfdk-aac shared libraries cross-compiled for:
    • Linux (64-bit)
    • Windows (32-bit and 64-bit)
    • OSX (64-bit, compiled with Xcode 9.4.1 SDK)
  • Provided fdk-aac version is 0.1.6
  • Both versions 0.1.6 and 0.1.6 were tested and found to comply with this bridge.

Encoding using the JVM AudioSystem

AudioInputStream input = AudioSystem.getAudioInputStream(...);
File output = new File(...);
AudioSystem.write(input, AACFileTypes.AAC_LC, output);

Performance

Performance benchmarks comparing JNA to a BINARY application(aac-enc) are available using JMH and JMH Visualizer:

alt text

To run the benchmarks locally:

  • Clone this repository onto a Linux host
  • Ensure that you have libfdk-aac.so library installed (either from an external repository or manually compiled)
  • Ensure that you have the aac-enc binary installed (either from an external repository or manually compiled)
  • Run the following command (from within the cloned repository)
./gradlew -b benchmark.gradle jmh jmhReport
  • If the aac-enc binary is not installed in /usr/bin/aac-enc, you can a custom path path by adding this gradle property:
-PaacEncBin=/CUSTOM/PATH/TO/AAC-ENC 
  • The JMH reports can be viewed by opening build/reports/benchmark/index.html in your browser.

Limitations

Currently, libfdk-aac itself supports only the pcm_s16le WAV input format, meaning:

  • Sample size - 16 bit(signed)
  • WAV format - (L)PCM
  • Byte order - Little Endian

While this form of input formatting seems to be the common raw-audio formatting, it's important to note that providing input audio with different formatting will cause the encoding process to fail.

Additional restrictions:

  • A maximum of 6 audio input/output channels
  • Only the AAC-LC/HE-AAC/HE-AACv2 encoding profiles are supported

Roadmap

  • Upgrade to fdk-aac 2.0.x
  • Improved lower-level interface (with examples).
  • Support for 24 bit WAV input (via conversion).
  • M4A encoding.
  • AAC decoding ???

Versions

Version
0.1.6
0.1.5
0.1.4
0.1.3
0.1.2
0.1.1
0.1.0