Java wrapper around the FFmpeg command line tool
Java wrapper around the FFmpeg command line tool
by Andrew Brampton (bramp.net) (c) 2013-2024 A fluent interface for running FFmpeg from Java.
We currently support Java 11 and above. Use Maven to install the dependency.
<dependency>
<groupId>net.bramp.ffmpeg</groupId>
<artifactId>ffmpeg</artifactId>
<version>0.9.1</version>
</dependency>Code:
…Code:
FFprobe ffprobe = new FFprobe("/path/to/ffprobe");
FFmpegProbeResult probeResult = ffprobe.probe("input.mp4");
FFmpegFormat format = probeResult.getFormat();
System.out.format(
"%nFile: '%s' ; Format: '%s' ; Duration: %.3fs",
format.filename, format.format_long_name, format.duration);
FFmpegStream stream = probeResult.getStreams().get(0);
System.out.format(
"%nCodec: '%s' ; Width: %dpx ; Height: %dpx",
stream.codec_long_name, stream.width, stream.height);…If you wish to make changes, then building and testing is simple:
# To build
mvn compile
# To test
mvn test
# To test across all supported JDKs (11, 17, 21)
make testReleasing is automated via GitHub Actions. To trigger a release to Maven Central:
pom.xml (remove -SNAPSHOT).git tag ffmpeg-0.9.1
git push origin ffmpeg-0.9.1The GitHub Action will:
# Update Maven Plugins
mvn versions:display-plugin-updates
# Library Dependencies
mvn versions:display-dependency-updatesWe only the support the original FFmpeg, not the libav version. Before Ubuntu 12.04, and in 15.04 and later the original FFmpeg is shipped. If you have to run on a version with libav, you can install FFmpeg from a PPA, or using the static build. More information here
We welcome contributions. Please check the issue tracker. If you see something you wish to work on, please either comment on the issue, or just send a pull request. Want to work on something else, then just open a issue, and we can discuss! We appreciate documentation improvements, code cleanup, or new features. Please be mindful that all work is done on a volunteer basis, thus we can be slow to reply.
…No open issues yet, or sync has not completed.