javaffmpegprocessbuilderruntime.exec

How to use FFmpeg with Java?


I'm using the following command to convert sequence of images to a video:

ffmpeg -r 1 -i sample%d.png -s 320x240 -aspect 4:3 output.flv

This works fine for me!

Now I'm trying to use the above command to run through Java code.

How can I run the FFmpeg command using Runtime.getRuntime() from my Java code?


Solution

  • Runtime.getRuntime().exec("ffmpeg -r 1 -i sample%d.png -s 320x240 -aspect 4:3 output.flv");