FFmpeg for Audio Transcoding

36 views
Skip to first unread message

AppietraLata

unread,
Jun 9, 2020, 4:19:23 AM6/9/20
to javacpp
Hello,
I'd like to use JavaCPP and FFmpeg in order to transcode audio file from WAV (g711) to AMR and vice-versa.
Following example in the API doc I see that using of ProcessBuilder is suggested.
Now I would like to understand:
- is this a preferred method respect to the Runtime.exec() of the ffmpeg command? Why this approach should be better?
- if there is a more convenient (and performant) way to implement audio transcoding. For example by using directly the JNI implementation.

Thank you.
Regards.
Giuliano

Samuel Audet

unread,
Jun 9, 2020, 8:14:56 PM6/9/20
to javacpp...@googlegroups.com, AppietraLata
If your input and output are files (or URLs that the ffmpeg program
supports), with no custom processing in between, then it's usually a
better idea to use that program:
http://bytedeco.org/javacpp-presets/ffmpeg/apidocs/org/bytedeco/ffmpeg/ffmpeg.html

Using JNI isn't going to make it faster, it's just going to make it more
verbose, and JavaCV doesn't (yet) expose all the functionality of the
libraries from FFmpeg.

Samuel
Reply all
Reply to author
Forward
0 new messages