I\'m pretty new to Java, need to write a program that listen to video conversion instructions and convert the video once an new instruction arrives (instructions is stored i
I wrote my own Java ffmpeg command line wrapper: Jaffree. It works with both ffprobe and ffmpeg and supports programmatic video production and consumption. Also it has in my opinion more convenient fluid API.
Here is an ffprobe usage example:
FFprobeResult result = FFprobe.atPath(BIN)
.setInputPath(VIDEO_MP4)
.setShowStreams(true)
.setShowError(true)
.execute();
if (result.getError() != null) {
//TODO handle ffprobe error message
return;
}
for (Stream stream : probe.getStreams().getStream()) {
//TODO analyze stream data
}
ProgressListener listener = new ProgressListener() {
@Override
public void onProgress(FFmpegProgress progress) {
//TODO handle progress data
}
};
And this is for ffmpeg:
FFmpegResult result = FFmpeg.atPath(BIN)
.addInput(Input.fromPath(VIDEO_MP4))
.addOutput(Output.toPath(outputPath)
.addCodec(null, "copy")
)
.setProgressListener(listener)
.execute();
Also, as of Xuggler 3.3, Xuggler is LGPL meaning you don't need a commercial license.