Getting Started with FFMPEG-Java

Note : FFMPEG-Java is not the same thing as Jffmpeg. FFMPEG-Java is a sub-project of Freedom for Media in Java, FMJ in short.

This project is licensed under the LGPL. It has optional GPL components for using FFMPEG's GPL swscale library. If you wish to use swscale and the GPL, use ffmpeg-java-gpl.jar. The standard LGPL jar for this project is ffmpeg-java.jar.

FFMPEG-Java is a Java wrapper around FFMPEG, using JNA. It assumes that dynamic libraries for FFMPEG have been compiled, and are in your library path.

Note : mmx is disabled in this example, as it has caused problems in the past.

Step 1 : Get FFMPEG sources from

Step 2 : Build/install FFMPEG

./configure --disable-mmx --enable-shared


sudo make install


Step 3 : Run one of the sample programs with a media file as the first parameter.

In several *nix systems, sometimes have to set your library path explicitly. For example :

export LD_LIBRARY_PATH=/usr/local/lib



Plays a movie in a window :

java -cp ./ffmpeg-java.jar:./lib/jna.jar net.sf.ffmpeg_java.example.PlayerExample



Creates 5 ppm files in the current directory with the first 5 frames of the movie :

java -cp ./ffmpeg-java.jar:./lib/jna.jar net.sf.ffmpeg_java.example.AVCodecSample


Very good documentation how to setup build environment - msys and mingw - and how to build FFMPEG on Windows can be found in here. The FFMPEG builts provided there have worked too, but some image codecs/formats were missing.