Home›Java›Mods›FFmpegLib
FFmpegLib
ModsJava

FFmpegLib

Java mod listed for Minecraft 1.20–1.21. Downloads from the MC Java Mods app on Android.

by FLYover67 · on CurseForge

Which build do you need?

This mod ships a separate file for every mod loader and every version of the game. Pick both, then download — the wrong build installs fine and then does nothing in the game.

Mod loader

Minecraft version

⬇ Download for 1.21.1 · NeoForge⬇ Download for 1.20.1 · Forge
I don't know my version or loader
Open the Minecraft launcher and look at the profile you play on — it names both, like fabric-loader-1.21.4. The version also shows in the bottom-right corner of the game's main menu.
No loader in the profile name? Then it's plain Minecraft, and these mods won't run — you need Fabric or NeoForge installed first.

FFmpegLib is a technical library mod for Minecraft NeoForge 1.21.1 that integrates FFmpeg multimedia capabilities directly into the game. It adds no content for players, serving strictly as an API for other mods to handle dynamic media processing in background threads without lagging the main game loop

Please report any errors and/or ask any questions in the comments and/or via private message to me

Features :

— Executable Management: Automatically tracks and manages the ffmpeg.exe file inside config/ffmpeglib/
— Asynchronous Orchestrator: Provides a Java API (FFmpegOrchestrator) to run heavy video/audio processing tasks using CompletableFuture
— Frame Extraction: Converts video files (e.g., mp4) into a sequence of PNG frames at a specified FPS for custom GUI or in-game rendering
— Crash Isolation: Runs all decoding tasks in separate processes to prevent Minecraft from crashing if a media file is corrupted.


API Methods

Video Frame Extraction

Converts a video into sequential images named frame_%04d.png inside the target folder

— Signature

public static CompletableFuture<Void> extractFrames(File ffmpegExe, File videoFile, File targetDir, int fps)

— Parameters

ffmpegExe: The path to the verified FFmpeg executable

videoFile: The source video file to process

targetDir: The destination folder for the output PNG frames

fps: The target frame rate (number of frames extracted per second)


An example from lost in fog (approximate)

@SubscribeEvent
public static void onClientLogin(net.neoforged.neoforge.client.event.ClientPlayerNetworkEvent.LoggingIn event) {
    if (!ffmpegExe.exists() || !ffmpegExe.isFile()) {
        Minecraft.getInstance().execute(() -> {
            Minecraft.getInstance().setScreen(new FfmpegMissingScreen(null));
        });
        return;
    }

    CompletableFuture.runAsync(() -> {
        try {
            for (int d = 1; d <= 5; d++) {
                File targetDir = new File(cadriDir, "video" + d);
                File videoFile = new File(videoDir, "anal" + d + ".mp4");
                
                if (!videoFile.exists()) extractVideoResource(d, videoFile);
                
                if (!targetDir.exists()) targetDir.mkdirs();
                File[] existingFrames = targetDir.listFiles();
                
                if (existingFrames == null || existingFrames.length == 0) {
                    // HERE
                    FFmpegOrchestrator.extractFrames(ffmpegExe, videoFile, targetDir, 25).join();
                }
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
    });
}

I'm not an expert in programming or creating libraries for mods, so this library turned out to be small. I tried to describe all the methods used, and this mod is mostly intended as a supplement to lost in fog rather than a standalone library

Quick facts

Install steps are the general flow for this file type — How to install Minecraft Java mods & modpacks walks through it step by step.

File checked by MCModsHub

These come from our own check of the pack file, not from the source page.

Explore more