You have many options, and it depends on how much effort you want to invest and what limitations you have regarding the execution platform.
Many developers will simply make System.exec () calls to external decoding / encoding / label executable files by writing intermediate files to disk. This is a little awkward, but once it is configured correctly, it works.
A more difficult option is to use libraries like the ones you found. You can still use the file system to temporarily store the uncompressed version.
However, you can avoid the intermediate step β and possibly do it faster β by pipelining. You must supply the decoder output as an encoder input and set both of them.
The details of this are API dependent. If you're lucky, they can work with pieces, and you can manage them in a single thread.
If they work with threads, you may need to get your hands dirty and work with threads. One stream for the encoder, one for the decoder.
source share