Search code examples
javaffmpegruntime.exec

Use Java FFmpeg wrapper, or simply use Java runtime to execute FFmpeg?


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 are stored in Amazon SQS, but it's irrelevant to my question)

I'm facing a choice, either use Java runtime to exec FFmpeg conversion (like from command line), or I can use a FFmpeg wrapper written in Java.

http://fmj-sf.net/ffmpeg-java/getting_started.php

I'd much prefer using Java runtime to exec FFmpeg directly, and avoid using java-ffmpeg wrapper as I have to learn the library.

So my question is this: Are there any benefits using java-ffmpeg wrapper over exec FFmpeg directly using Runtime?

I don't need FFmpeg to play videos, just convert videos.


Solution

  • If I'm not mistaken, the "ffmpeg-wrapper" project you linked to is out of date and not maintained. FFmpeg is a very active project, lot's of changes and releases all the time.

    You should look at the Xuggler project, this provides a Java API for what you want to do, and they have tight integration with FFmpeg.

    http://www.xuggle.com/xuggler/

    Should you choose to go down the Runtime.exec() path, this Red5 thread should be useful:

    http://www.nabble.com/java-call-ffmpeg-ts15886850.html