Skip to content
Projets

À propos

AAC encoding capabilities for the JVM

Design et médias

Comment ces chiffres sont mesurés

Progression mesurée des étoiles

in 24h
0
in 7 days
0
in 15 days
Historique en cours
in 1 month
Historique en cours

Variations nettes sur des périodes qui se chevauchent, pas des totaux quotidiens. Les mesures absentes restent vides. Les étoiles indiquent l’intérêt, pas la qualité.

README.md

Original

jna-aac-encoder

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

This library provides AAC encoding and decoding 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.

Sponsorship

Enjoying my work? A show of support would be much obliged :grin:

  

Usage

Dependencies

Artifacts are available on maven central:

Maven


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

Gradle

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

Additional information

  • Single artifact containing libfdk-aac shared libraries cross-compiled for:
    • Linux (64-bit)
    • Windows (64-bit)
    • OSX (Intel 64-bit / Apple Silicon, compiled with the macOS 15.5 SDK)

Version matrix

Library Version FDK-AAC Version JDK Version Supported Platforms
2.1.2 - 2.2.0 2.0.3 17 Linux, Windows, OSX (Intel / Apple Silicon)
2.1.0 - 2.1.1 2.0.2 11 Linux, Windows, OSX (Intel / Apple Silicon)
2.0.0 2.0.2 8 Linux, Windows, OSX (Intel / Apple Silicon)
0.1.9 0.1.6 8 Linux, Windows (64/32 Bit), OSX (Intel)

Encoding using the JVM AudioSystem

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

Decoding using the JVM AudioSystem

ADTS framed AAC audio (.aac files, AAC-LC/HE-AAC/HE-AACv2) is detected automatically and decoded to 16 bit signed little-endian PCM:

AudioInputStream aac = AudioSystem.getAudioInputStream(new File(...));
AudioInputStream pcm = AudioSystem.getAudioInputStream(AudioFormat.Encoding.PCM_SIGNED, aac);
AudioSystem.write(pcm, AudioFileFormat.Type.WAVE, new File(...));

Dependency Locking

Dependencies are pinned via Gradle dependency locking. Lock state lives in gradle.lockfile at the repo root.

Locking is enabled for the following configurations only: api, compileClasspath, implementation, runtimeOnly, runtimeClasspath, testImplementation, testRuntimeOnly, testCompileClasspath, testRuntimeClasspath.

Refresh the lockfiles after changing dependencies or versions:

./gradlew lock

The lock task auto-enables --write-locks, so no extra flag is needed.

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 2.0.3 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
  • Decoding supports ADTS framed AAC only (no M4A/MP4 containers). Encoder priming samples are not trimmed, so decoded audio is slightly longer than the original input

Roadmap

  • Improved lower-level interface (with examples).
  • Support for 24 bit WAV input (via conversion).
  • M4A encoding/decoding.

Explorer des projets similaires

Chargement…