Java Image and Video Libraries
|
This content was generated with the assistance of AI and should be verified against the official documentation before being relied on in production. |
Baseline date: 2026-10-07. Versions below are the latest releases listed on Maven Central on that date. Check each project’s repository for newer releases and for its licence before you adopt it. Scrimage 4.6.11 (2026-10-29) and vips-ffm 1.11.1 (2026-11-01) were published after the baseline date, and JAVE2 has a 4.x line (4.2.0 in August 2026), so look at the changelogs when you upgrade the pinned versions. The code on this page was compiled and run with the versions it names (Java 17 for the ImageIO, Thumbnailator, Scrimage, blurhash-java, Jaffree and JAVE2 examples; Java 25 for vips-ffm, which needs Java 22 or newer).
Choosing an image library
| Library | Licence | Status | Notes |
|---|---|---|---|
MIT |
Maintained (0.4.21) |
ImageIO-based. Resize, crop, rotate, watermark, with a fluent API. The recommended default for JVM thumbnails. |
|
Apache-2.0 |
Unmaintained: last release 4.2, 2012 |
Legacy only. Do not choose it for new code. |
|
BSD-3-Clause |
Maintained (3.15.3) |
Plugins for ImageIO: JPEG including CMYK, TIFF, PSD and more. WebP is read only. No AVIF or HEIC. |
|
Apache-2.0 |
Check the repository |
ImageIO plugin that writes WebP through native libraries. |
|
Apache-2.0 |
Maintained (4.6.8) |
Immutable image API with filters and a WebP writer ( |
|
vips-ffm: Apache-2.0. JVips: check the repository |
vips-ffm: maintained (1.9.9 on the baseline date). JVips: check the repository |
Bindings to libvips, for the fastest throughput on large images. vips-ffm uses the Java foreign function and memory API: its 1.9.9 class files are compiled for Java 22, so it needs JDK 22 or newer, plus libvips installed. |
ImageIO on its own reads JPEG, PNG, GIF and BMP and writes the same. WebP, AVIF and HEIC need extra libraries or a native engine such as libvips. When AVIF output is a requirement, libvips is the practical route on the JVM, see image formats and encoding.
Thumbnailator
<dependency>
<groupId>net.coobird</groupId>
<artifactId>thumbnailator</artifactId>
<version>0.4.21</version>
</dependency>
import net.coobird.thumbnailator.Thumbnails;
import net.coobird.thumbnailator.geometry.Positions;
import java.io.File;
import javax.imageio.ImageIO;
import javax.imageio.ImageReader;
import javax.imageio.stream.ImageInputStream;
// A 2:3 cover thumbnail: scale to fill, crop the overflow from the centre, JPEG at 80.
Thumbnails.of(new File("original.jpg"))
.size(640, 960)
.crop(Positions.CENTER)
.outputFormat("jpg")
.outputQuality(0.8)
.toFile(new File("w640.jpg"));
// A width-bounded variant. Thumbnailator has no "do not enlarge" option, so .width(1280) would upscale
// a smaller original: read the width from the image header first and cap the target at it.
File original = new File("original.jpg");
int sourceWidth;
try (ImageInputStream in = ImageIO.createImageInputStream(original)) {
ImageReader reader = ImageIO.getImageReaders(in).next();
reader.setInput(in);
sourceWidth = reader.getWidth(0); // header width, before EXIF rotation: compare with the height for orientations 5 to 8
reader.dispose();
}
Thumbnails.of(original)
.width(Math.min(1280, sourceWidth))
.toFile(new File("w1280.jpg"));
Thumbnailator applies the EXIF orientation by default. References: Thumbnailator on GitHub and its Javadoc.
TwelveMonkeys and WebP
<dependency>
<groupId>com.twelvemonkeys.imageio</groupId>
<artifactId>imageio-jpeg</artifactId>
<version>3.15.3</version>
</dependency>
<dependency>
<groupId>com.twelvemonkeys.imageio</groupId>
<artifactId>imageio-webp</artifactId>
<version>3.15.3</version>
</dependency>
Adding the plugins to the classpath registers them with ImageIO, so ImageIO.read(file) can then read WebP and
unusual JPEGs. They do not write WebP. To write WebP from the JVM, use webp-imageio, Scrimage’s WebP module, or call
libvips or cwebp. Reference: TwelveMonkeys ImageIO.
Scrimage
<dependency>
<groupId>com.sksamuel.scrimage</groupId>
<artifactId>scrimage-core</artifactId>
<version>4.6.8</version>
</dependency>
<dependency>
<groupId>com.sksamuel.scrimage</groupId>
<artifactId>scrimage-webp</artifactId>
<version>4.6.8</version>
</dependency>
import com.sksamuel.scrimage.ImmutableImage;
import com.sksamuel.scrimage.webp.WebpWriter;
import java.io.File;
ImmutableImage image = ImmutableImage.loader().fromFile(new File("original.jpg"));
image.scaleToWidth(640).output(WebpWriter.DEFAULT.withQ(78), new File("w640.webp"));
Reference: Scrimage on GitHub.
libvips from Java
<dependency>
<groupId>app.photofox.vips-ffm</groupId>
<artifactId>vips-ffm-core</artifactId>
<version>1.9.9</version>
</dependency>
vips-ffm needs the libvips shared library on the host and a JDK that supports the foreign function and memory API. Check
the repository README for the exact JDK and libvips requirements, and for the API, which mirrors libvips operations
(thumbnail, heifsave, webpsave). The criteo/JVips binding is an alternative that uses JNI. When neither fits, a
worker that runs the vips command line tool through ProcessBuilder is a robust option.
A thumbnail in the three variants of the running example, written with Java 25, vips-ffm 1.9.9 and libvips 8.15.1 from the Ubuntu package (run with --enable-native-access=ALL-UNNAMED):
import app.photofox.vipsffm.VImage;
import app.photofox.vipsffm.Vips;
import app.photofox.vipsffm.VipsOption;
import app.photofox.vipsffm.enums.VipsSize;
Vips.run(arena -> {
VImage thumb = VImage.thumbnail(arena, "phone.jpg", 640,
VipsOption.Int("height", 10_000_000), // bound the width only
VipsOption.Enum("size", VipsSize.SIZE_DOWN)); // never enlarge
thumb.jpegsave("w640.jpg", VipsOption.Int("Q", 80), VipsOption.Boolean("optimize_coding", true), VipsOption.Boolean("strip", true));
thumb.webpsave("w640.webp", VipsOption.Int("Q", 78), VipsOption.Boolean("strip", true));
thumb.heifsave("w640.avif", VipsOption.Int("Q", 60), VipsOption.Int("effort", 5), VipsOption.Boolean("strip", true));
});
It reported a 640 by 960 result (orientation applied, from the 3600 by 2400 phone file) and wrote 46,905 bytes of JPEG, 24,078 bytes of WebP and 11,026 bytes of AVIF in about 0.8 seconds in total,
with no EXIF left in any of them (vipsheader -a found no exif or gps field). Every native object is tied to the Arena that Vips.run opens, so nothing has to be closed by hand and nothing may
be used after the lambda returns. thumbnail shrinks on load, which is why it is the operation to use rather than newFromFile followed by a resize. The VImage API mirrors the libvips
operation names, so the libvips documentation is the reference for every option.
A complete cover job
The running example of this section is the cover of Moby-Dick, id b81f, uploaded from a phone as a 3600 by 2400 JPEG with EXIF orientation 6 (so it is a 2400 by
3600 portrait once rotated). The class below is a whole image job in plain Java: it checks the header before decoding anything, applies the orientation, produces
JPEG and WebP variants at 320, 640 and 1280 pixels (never wider than the original), and encodes a 3 by 4 BlurHash from a 64 by 96 thumbnail.
import com.sksamuel.scrimage.ImmutableImage;
import com.sksamuel.scrimage.webp.WebpWriter;
import io.trbl.blurhash.BlurHash;
import net.coobird.thumbnailator.Thumbnails;
import javax.imageio.ImageIO;
import javax.imageio.ImageReader;
import javax.imageio.stream.ImageInputStream;
import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.ArrayList;
import java.util.List;
import java.util.Set;
import java.util.TreeSet;
/** Variants and BlurHash for one cover, producing the record the media API returns. */
public class Cover {
static final long MAX_PIXELS = 60_000_000L;
static final Set<String> ALLOWED = Set.of("JPEG", "png", "webp");
record Variant(String format, int width, long bytes, String key) {}
record Result(String id, int width, int height, String blurhash, List<Variant> variants) {}
/** Reads width, height and format from the header only. Nothing is decoded. */
static int[] inspect(byte[] data) throws IOException {
try (ImageInputStream in = ImageIO.createImageInputStream(new ByteArrayInputStream(data))) {
var readers = ImageIO.getImageReaders(in);
if (!readers.hasNext()) throw new IOException("not an image");
ImageReader reader = readers.next();
try {
reader.setInput(in);
String format = reader.getFormatName();
if (!ALLOWED.contains(format)) throw new IOException("format " + format + " is not accepted");
int w = reader.getWidth(0), h = reader.getHeight(0);
if ((long) w * h > MAX_PIXELS) throw new IOException(w + "x" + h + " exceeds the pixel cap");
return new int[] {w, h};
} finally {
reader.dispose();
}
}
}
static Result process(byte[] data, String id, Path out) throws IOException {
inspect(data); // header checks first
ImmutableImage image = ImmutableImage.loader().fromBytes(data); // applies the EXIF orientation
Files.createDirectories(out);
List<Variant> variants = new ArrayList<>();
for (int width : new TreeSet<>(List.of(Math.min(320, image.width), Math.min(640, image.width), Math.min(1280, image.width)))) {
File jpg = out.resolve("w" + width + ".jpg").toFile();
Thumbnails.of(new ByteArrayInputStream(data)).width(width).outputFormat("jpg").outputQuality(0.8).toFile(jpg);
variants.add(new Variant("jpeg", width, jpg.length(), "covers/" + id + "/" + jpg.getName()));
File webp = out.resolve("w" + width + ".webp").toFile();
image.scaleToWidth(width).output(WebpWriter.DEFAULT.withQ(78), webp);
variants.add(new Variant("webp", width, webp.length(), "covers/" + id + "/" + webp.getName()));
}
var thumb = Thumbnails.of(new ByteArrayInputStream(data)).forceSize(64, 96).asBufferedImage(); // 2:3, so 3 x 4 components
return new Result(id, image.width, image.height, BlurHash.encode(thumb, 3, 4), variants);
}
}
Run on the phone file with a 256 MB heap (java -Xmx256m), it prints:
b81f 2400x3600 TIAnvPR,4pm#a#WB01t6?aN2j[t6
Variant[format=jpeg, width=320, bytes=18891, key=covers/b81f/w320.jpg]
Variant[format=webp, width=320, bytes=11130, key=covers/b81f/w320.webp]
Variant[format=jpeg, width=640, bytes=49590, key=covers/b81f/w640.jpg]
Variant[format=webp, width=640, bytes=23700, key=covers/b81f/w640.webp]
Variant[format=jpeg, width=1280, bytes=126795, key=covers/b81f/w1280.jpg]
Variant[format=webp, width=1280, bytes=46536, key=covers/b81f/w1280.webp]
The 20000 by 20000 PNG of 388 KB (a decompression bomb) was rejected with 20000x20000 exceeds the pixel cap and a GIF renamed .mov with
format gif is not accepted, both before any pixel was decoded, and a 400 by 600 PNG was accepted and produced variants no wider than 400 pixels. Three observations
from the numbers: the Thumbnailator JPEGs are larger than the 47,365 bytes that Pillow produced at the same nominal quality 80 for the 640 pixel width
(49,590), because the JDK’s JPEG writer does not optimise its Huffman tables by default, see
image formats and encoding; the WebP files are about half the size of the JPEGs; and the whole job took about a
second and a half including JIT warm-up and the extraction of the native cwebp binary (below). The JSON the API returns for this record is the one in
responsive images and thumbnails.
ImageIO, memory and subsampling
ImageIO decodes into a BufferedImage that holds every pixel. A 6000 by 9000 pixel JPEG needs about 162 MB for a decoded RGB image, and a 20000 by 20000 grey PNG needs
400 MB, whatever their file size. With a 128 MB heap, ImageIO.read on the 6000 by 9000 JPEG failed with OutOfMemoryError, while a reader with source subsampling
returned a 750 by 1125 image in 150 ms:
try (ImageInputStream in = ImageIO.createImageInputStream(file)) {
ImageReader reader = ImageIO.getImageReadersByFormatName("jpeg").next();
reader.setInput(in);
ImageReadParam param = reader.getDefaultReadParam();
param.setSourceSubsampling(8, 8, 0, 0); // keep every 8th pixel in both directions
BufferedImage small = reader.read(0, param); // 750 x 1125 from 6000 x 9000
reader.dispose();
}
For the PNG bomb, ImageIO.read with a 256 MB heap threw an IIOException ("Caught exception during read") whose cause was the OutOfMemoryError: catching OutOfMemoryError is not a
defence, because the damage (a stalled GC, a killed container) happens before you can react. Check the header first, as inspect above does, and give the worker a memory
limit. Subsampling is the way to read a large JPEG within a small heap, at the price of keeping every nth pixel instead of averaging them, so follow it with a proper resize when quality matters.
It saves memory more than time: on the 2400 by 3600 cover the subsampled read took 44 ms and the full read 50 ms.
The JPEG writer is controlled through ImageWriteParam. On the 600 by 900 reduction of the cover, with setOptimizeHuffmanTables(true), the progressive flag was a small win at the higher
qualities and a loss at the lowest:
| Quality | Baseline | Progressive |
|---|---|---|
0.6 |
29,751 B |
30,748 B |
0.8 |
45,343 B |
45,193 B |
0.9 |
65,760 B |
63,455 B |
ImageWriter writer = ImageIO.getImageWritersByFormatName("jpeg").next();
JPEGImageWriteParam params = (JPEGImageWriteParam) writer.getDefaultWriteParam();
params.setCompressionMode(ImageWriteParam.MODE_EXPLICIT);
params.setCompressionQuality(0.8f);
params.setProgressiveMode(ImageWriteParam.MODE_DEFAULT);
params.setOptimizeHuffmanTables(true);
try (ImageOutputStream out = ImageIO.createImageOutputStream(target)) {
writer.setOutput(out);
writer.write(null, new IIOImage(rgbImage, null, null), params); // rgbImage must be TYPE_INT_RGB, JPEG has no alpha
}
writer.dispose();
Orientation in Java
Thumbnailator honours the EXIF orientation by default: Thumbnails.of(phoneFile).size(640, 960) returned a 640 by 960 portrait for the orientation 6 file. With
.useExifOrientation(false) it returned 640 by 427, the stored landscape pixels, which is the sideways cover users see when a pipeline ignores the tag. Scrimage’s
loader also applied it (ImmutableImage.loader().fromBytes(...) reported 2400 by 3600). Plain ImageIO.read never applies it, and neither does reader.getWidth(0), which is
why inspect above is only used for the pixel count, not for the displayed size.
Native binaries and read-only containers
Scrimage’s WebP writer and JAVE2 do not contain Java encoders. At first use they copy a native executable (cwebp, dwebp or FFmpeg) out of the jar into the temporary directory, mark it
executable and run it as a child process: the run above logged Installing binary at /var/folders/.../cwebp...binary and Setting executable. In a container with a read-only root
file system (as recommended in security and operations) mount a writable tmpfs at the temporary directory, and make it
executable (a noexec mount makes the extracted binary fail to start). The extracted binary is also a second place where a CVE can hide: the libwebp version is the one inside the jar, not the
one of the operating system.
Choosing a Java library
BlurHash in Java
blurhash-java is the encoder listed in the BlurHash implementations list. Encode
from a downscaled BufferedImage, never from the original.
<dependency>
<groupId>io.trbl</groupId>
<artifactId>blurhash</artifactId>
<version>1.0.0</version>
</dependency>
import io.trbl.blurhash.BlurHash;
import net.coobird.thumbnailator.Thumbnails;
import java.awt.image.BufferedImage;
import java.io.File;
BufferedImage small = Thumbnails.of(new File("original.jpg"))
.size(64, 64) // fits inside 64 x 64 and keeps the aspect ratio
.asBufferedImage();
String hash = BlurHash.encode(small, 4, 3); // 4 x 3 components, 28 characters
The snippet fits the image inside 64 by 64, so the 2400 by 3600 cover became 43 by 64 pixels and encode(small, 4, 3) returned LJAeBqWF4:WYiXa#WBa#02t6?aof. The
cover is portrait with a 2:3 ratio, so the running example uses the shape that matches it, a 64 by 96 thumbnail and 3 columns by 4 rows of components (the encoder takes the number of components
along x first, then along y: the first character of the string, T, is the size flag 2 + 9 * 3 = 29 for this grid):
BufferedImage thumb = Thumbnails.of(new File("original.jpg")).forceSize(64, 96).asBufferedImage(); // exactly 2:3
String hash = BlurHash.encode(thumb, 3, 4); // 4 + 2 * 3 * 4 = 28 characters
On the 64 by 96 pixel PNG used for the cross-checks of this section, blurhash-java returned TIAxG?R,4pm#f8WB01t6?aN2j[t6, character for character the string that the reference TypeScript encoder
(blurhash 2.0.5) returns for the same pixels. The blurhash-python package returns a different string for those pixels (TKAxG?R,9Gm#f8WC0Lt6?GN1j[t6), because it wraps the C reference code, which takes the
largest absolute AC value where the TypeScript and Java encoders take the largest signed value. Both strings are valid and decode to nearly the same picture (a mean difference of 4.6 on a 0 to 255
scale), so never use the hash as a cache key across services written in different languages, and compare implementations by decoding, see
the BlurHash page.
Choose the components from the aspect ratio, as explained in the BlurHash page. Reference: hsch/blurhash-java. The Kotlin Multiplatform library vanniktech/blurhash (0.3.0) is an alternative for Kotlin code.
Video from Java
Video from Java means driving FFmpeg. Both libraries below need FFmpeg and FFprobe, either installed on the host or, for JAVE2, bundled.
| Library | Licence | Notes |
|---|---|---|
Apache-2.0 |
Wraps the FFmpeg and FFprobe command line tools. Latest release listed on Maven Central: 2024.08.29. You tell it where FFmpeg is installed. |
|
GPL-3.0 |
Bundles FFmpeg binaries for common platforms, which is convenient and brings GPL obligations and the licences of the bundled codecs. Check them against your distribution model before you use it in a closed-source product. |
Jaffree: transcode, cover and probe
<dependency>
<groupId>com.github.kokorin.jaffree</groupId>
<artifactId>jaffree</artifactId>
<version>2024.08.29</version>
</dependency>
import com.github.kokorin.jaffree.ffmpeg.FFmpeg;
import com.github.kokorin.jaffree.ffmpeg.UrlInput;
import com.github.kokorin.jaffree.ffmpeg.UrlOutput;
import com.github.kokorin.jaffree.ffprobe.FFprobe;
import com.github.kokorin.jaffree.ffprobe.FFprobeResult;
import java.nio.file.Path;
import java.nio.file.Paths;
Path bin = Paths.get("/usr/bin"); // directory that contains ffmpeg and ffprobe
// Probe first, to reject files that are not what the user claimed.
FFprobeResult probe = FFprobe.atPath(bin)
.setShowStreams(true)
.setShowFormat(true) // without it ffprobe returns no format section and getFormat() is null
.setInput("input.mov")
.execute();
double seconds = probe.getFormat().getDuration();
// Transcode to a 720p H.264 rendition with a keyframe every 2 seconds at 24 fps.
FFmpeg.atPath(bin)
.addInput(UrlInput.fromPath(Paths.get("input.mov")))
.addArguments("-vf", "scale=-2:720")
.addArguments("-c:v", "libx264")
.addArguments("-crf", "22")
.addArguments("-g", "48")
.addArguments("-c:a", "aac")
.addOutput(UrlOutput.toPath(Paths.get("720p.mp4")))
.execute();
// Extract a cover frame at 10 percent of the duration.
FFmpeg.atPath(bin)
.addInput(UrlInput.fromPath(Paths.get("input.mov")).setPosition((long) (seconds * 100)))
.addOutput(UrlOutput.toPath(Paths.get("cover.jpg")).setFrameCount(null, 1L))
.execute();
The method names above follow Jaffree’s documented API at the time of writing, so verify them against the README of the version you install. Reference: Jaffree on GitHub.
The code compiles and runs unchanged against Jaffree 2024.08.29 with FFmpeg 6.1.1 (Ubuntu 24.04, Java 17). The test input was a generated 10 second 1920 by 1080 H.264 and AAC clip
with a location tag. The probe returned a duration of 10.0 seconds, the format mov,mp4,m4a,3gp,3g2,mj2 and the streams h264 1920x1080 and aac. The 720p transcode (with
-preset veryfast instead of the default, to keep the run short) took 1.9 seconds and wrote 2,215,996 bytes, and the cover at 10 percent of the duration (setPosition takes milliseconds, so
1000 here) was a 73,408 byte JPEG.
Progress and hard time limits
Jaffree logs a warning when no progress listener is set. A listener receives FFmpeg’s -progress output, so a worker can update the progress column of the job table:
FFmpeg.atPath(bin)
.addInput(UrlInput.fromPath(input))
.addArguments("-c:v", "libx264")
.setProgressListener(progress -> {
double percent = 100.0 * progress.getTimeMillis() / (seconds * 1000);
jobs.updateProgress(mediaId, (int) percent); // hypothetical repository method
})
.addOutput(UrlOutput.toPath(output))
.execute();
In the test, the last callback reported 9,984 ms of a 10,000 ms clip. A hard time limit needs more care than the method names suggest:
-
setExecutorTimeoutMillis(1000)is not a limit on the encode. A-preset placeboencode of the 10 second clip configured with it ran to completion (it wrote a 6 MB file) instead of failing after a second. -
executeAsync()plusfuture.toCompletableFuture().get(2, TimeUnit.SECONDS)throwsTimeoutExceptionon time, but callingforceStop()on the future (orgraceStop(), which asks FFmpeg to quit) only cancelled the Java side in the test: theffmpegprocess was still running 6 seconds later. -
A
ProcessBuilderwithwaitFor(2, TimeUnit.SECONDS)followed bydestroyForcibly()stopped the same encode (exit code 137,isAlive()false).
When a runaway file must not hold a worker, run FFmpeg yourself with a hard limit, or run the whole worker in a container with CPU, memory and time limits, see security and operations:
Process process = new ProcessBuilder(List.of("ffmpeg", "-nostdin", "-hide_banner", "-loglevel", "error",
"-i", input.toString(), "-c:v", "libx264", "-y", output.toString()))
.redirectErrorStream(true)
.start();
if (!process.waitFor(10, TimeUnit.MINUTES)) {
process.destroyForcibly();
process.waitFor();
throw new IllegalStateException("transcode exceeded its time limit");
}
if (process.exitValue() != 0) {
throw new IllegalStateException("ffmpeg failed with exit code " + process.exitValue());
}
Drain the process output (or redirect it to a file or Redirect.DISCARD) in real code: a child that fills an unread pipe blocks forever. Jaffree reads FFmpeg’s output for you, which is its main advantage over this snippet.
JAVE2: transcode and cover
<dependency>
<groupId>ws.schild</groupId>
<artifactId>jave-core</artifactId>
<version>${jave.version}</version>
</dependency>
<dependency>
<groupId>ws.schild</groupId>
<artifactId>jave-nativebin-linux64</artifactId>
<version>${jave.version}</version>
</dependency>
import ws.schild.jave.Encoder;
import ws.schild.jave.MultimediaObject;
import ws.schild.jave.encode.AudioAttributes;
import ws.schild.jave.encode.EncodingAttributes;
import ws.schild.jave.encode.VideoAttributes;
import ws.schild.jave.info.VideoSize;
import java.io.File;
AudioAttributes audio = new AudioAttributes();
audio.setCodec("aac");
audio.setBitRate(128000);
VideoAttributes video = new VideoAttributes();
video.setCodec("libx264");
video.setSize(new VideoSize(1280, 720));
EncodingAttributes attrs = new EncodingAttributes();
attrs.setOutputFormat("mp4");
attrs.setAudioAttributes(audio);
attrs.setVideoAttributes(video);
new Encoder().encode(new MultimediaObject(new File("input.mov")), new File("720p.mp4"), attrs);
Set jave.version to the current release from the JAVE2 repository and pick the
native binary artifact for your platform. The example ran unchanged with jave-core and jave-nativebin-linux-arm64 4.2.0 (the latest on Maven Central in November 2026; the x86-64 artifact is
jave-nativebin-linux64) on Java 17: it read the clip, wrote a 1280 by 720 MP4 of 2,108,640 bytes in 1.7 seconds, and extracted its bundled FFmpeg into a jave directory under the system
temporary directory, with the same read-only file system consequence as Scrimage above. Its log output is verbose, since every FFmpeg line that it does not parse is logged at INFO. For fine control of rate and keyframes, passing arguments directly to FFmpeg
(as with Jaffree) is simpler than JAVE2’s attribute objects.
Whichever library you pick, run it in a worker with a time limit, a memory limit and a sandbox, see security and operations. The same code appears in a job pipeline in the Spring Boot and Quarkus pipeline.