https://github.com/sheinbergon/jna-aac-encoder
AAC encoding capabilities for the JVM
https://github.com/sheinbergon/jna-aac-encoder
aac aac-audio aac-encoding-capabilities audio audio-processing encoding fdk-aac java java11 jmh jna jna-aac-encoder libfdk-aac pcm
Last synced: 6 months ago
JSON representation
AAC encoding capabilities for the JVM
- Host: GitHub
- URL: https://github.com/sheinbergon/jna-aac-encoder
- Owner: sheinbergon
- License: lgpl-3.0
- Created: 2018-02-18T18:03:14.000Z (over 7 years ago)
- Default Branch: main
- Last Pushed: 2025-02-13T20:12:20.000Z (8 months ago)
- Last Synced: 2025-02-13T21:19:42.242Z (8 months ago)
- Topics: aac, aac-audio, aac-encoding-capabilities, audio, audio-processing, encoding, fdk-aac, java, java11, jmh, jna, jna-aac-encoder, libfdk-aac, pcm
- Language: Java
- Homepage:
- Size: 49.2 MB
- Stars: 29
- Watchers: 5
- Forks: 7
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# jna-aac-encoder
[](https://github.com/sheinbergon/jna-aac-encoder/blob/master/LICENSE)
[](https://github.com/sheinbergon/jna-aac-encoder/actions?query=workflow%3A"Multi+Platform+CI")
[](https://github.com/sheinbergon/jna-aac-encoder/releases/latest)
[](https://search.maven.org/search?q=g:org.sheinbergon%20a:jna-aac-encoder*)
[](https://coveralls.io/github/sheinbergon/jna-aac-encoder)
[](https://app.codacy.com/manual/sheinbergon/jna-aac-encoder)
[](https://liberapay.com/sheinbergon/donate)
This library provides AAC encoding capabilities for the JVM.
It utilizes the [FDK AAC](https://github.com/mstorsjo/fdk-aac) library via JNA in order to do so.## License
**Important!** While this library uses LGPL-3, please see
the [FDK AAC license](NOTICE) 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_**
```xmlorg.sheinbergon
jna-aac-encoder
2.1.0```
**_Gradle_**
```groovy
compile 'org.sheinbergon:jna-aac-encoder:2.1.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 Xcode 13.3 SDK)
* Tested with FDK-AAC version is 2.0.2
* Earlier `2.0.x` versions of FDK-AAC might work, but haven't been tested.
* For JDK 8 compatibility, please use version `2.0.0` of this library
* For `0.1.6`/`0.1.5` FDK-AAC support and Windows 32 bit support, please use version `0.1.9` of this library
### Encoding using the JVM AudioSystem
```java
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](http://openjdk.java.net/projects/code-tools/jmh/) and [JMH Visualizer](https://github.com/jzillmann/jmh-visualizer):
To run the benchmarks locally:
* Clone this repository onto a Linux host
* Ensure that you have `libfdk-aac.so` __2.0.2__ 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)
```groovy
./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:
```groovy
-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 EndianWhile 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
* Improved lower-level interface (with examples).
* Support for 24 bit WAV input (via conversion).
* M4A encoding.
* AAC decoding ???