DataJuggler.FFmpeg 1.0.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package DataJuggler.FFmpeg --version 1.0.0
                    
NuGet\Install-Package DataJuggler.FFmpeg -Version 1.0.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="DataJuggler.FFmpeg" Version="1.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="DataJuggler.FFmpeg" Version="1.0.0" />
                    
Directory.Packages.props
<PackageReference Include="DataJuggler.FFmpeg" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add DataJuggler.FFmpeg --version 1.0.0
                    
#r "nuget: DataJuggler.FFmpeg, 1.0.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package DataJuggler.FFmpeg@1.0.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=DataJuggler.FFmpeg&version=1.0.0
                    
Install as a Cake Addin
#tool nuget:?package=DataJuggler.FFmpeg&version=1.0.0
                    
Install as a Cake Tool

DataJuggler.FFmpeg

This project supports Leonard — a video upscaler that converts an MP4 to an image sequence using FFmpeg, upscales those images with Real-ESRGAN Vulkan, and then renders them back into a new MP4.

Project Leonard is coming soon. I hope to release Leonard by Tuesday, July 29th unless I get busy at work https://github.com/DatgaJuggler/Leonard

Leonard also includes a "Get Last Frame" feature, which is useful for creating continuing videos (where the first frame of the next video matches the last frame of the previous one).


Project Structure

DataJuggler.FFmpeg/ ├── FFmpegHelper.cs ├── RegisteredEvents.cs ├── FFmpeg/ │ └── bin/ │ └── ffmpeg.exe

StatusUpdate - Callback delegate to receive notifcations from long running processes.

Also included in this project is a delegate called StatusUpdate, used to notify callers something is happening using FFmpeg or also RealESRGANHelper used for upscaling using Vulkan.

Note: Vulkan is where the name Leonard came from (Spock came from Vulcan).

// This delegate is used to receive info from long running processes 
public delegate void StatusUpdate(string sender, string data);

Create a method to receive callbacks, and pass in that method name in place of StatusUpdate

Example Callback Method

To receive notifications, create a method in your project such as:

/// <summary>
/// This method is used to receive data from FFmpegHelper or RealESRGANHelper
/// </summary>
public void Callback(string senderName, string data)
{
    // Path to a log file
    string temp = @"c:\Temp\Log.txt";

    // Log the messages coming in
    File.AppendAllText(temp, data);    
}

Then to call any of the FFmpegHelper methods, pass in your Callback method for StatusUpdate.

If you do not need to receive notifications, pass in null for the StatusUpdate delegate.

If you find this project, or any of my 100+ other projects worth the price, please leave a star!

https://github.com/DataJuggler/

Sample Code. This sesction provides guidance on how to call the methods in this project

ConvertToImageSequence

Converts an MP4 into a numbered PNG sequence. The output will be in the format Image1.png, Image2.png, etc.

 // modify the paths
string inputPath = @"C:\Videos\MyInput.mp4";
string outputFolder = @"C:\Frames\Output";

// Perform convert from an mp4 to an image sequence
bool result = FFmpegHelper.ConvertToImageSequence(inputPath, outputFolder);

CreateMP4FromImages

The CreateMP4FromImages method will convert a directory of images into an MP4.

// modify the paths
string inputPath = @"C:\Temp\Upscaled";
string outputMp4Path = @"C:\Videos\Waterfall.mp4";

// Create an MP4 from a directory of images
bool result = FFmpegHelper.CreateMP4FromImages(inputPath, outputMp4Path, Callback, crf: 14, framerate: 30);

ExtractLastFrame

The ExtractLastFrame method is useful with AI videos where you want to use the last frame from one video as the first image in another continuing video.

This method will launch the last frame in your default image editor for .png's

// change to your paths
string inputPath = @"C:\Videos\MyInput.mp4";
string outputPath = @"C:\Temp\LastFrame.png";

// Extract the last frame
bool result = FFmpegHelper.ExtractLastFrame(inputPath, outputPath);

#region GetFFmpegPath()

This method is used internally to get the path to ffmpeg.exe, which is stored in this NuGet package. In most cases you should not have to call this method. It's only included for documentation purposes.

    /// <summary>
    /// method returns the F Fmpeg Path
    /// </summary>
    public static string GetFFmpegPath()
    {
        // return the Path to the FFmpeg folder
        return Path.Combine(AppContext.BaseDirectory, "FFmpeg", "bin", "ffmpeg.exe");
    }
    
    

SplitVideo

This method is used to split a video into smaller chunks. The Upscaling portion of Leonard is extrremely slow. A 2 minute video at 30 FPS is 3,600 images. Splitting the video up into smaller chunks is recommended.

// modify the paths
string inputPath = @"C:\Videos\MyInput.mp4";
string outputFolder = @"C:\Videos\Chunks";
int chunkLength = 15;

// Split the video into sections
bool result = FFmpegHelper.SplitVideo(inputPath, outputFolder, Callback, chunkLength);

If you have any problems or questions, please create an issue on GitHub.
Product Compatible and additional computed target framework versions.
.NET net9.0 is compatible.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on DataJuggler.FFmpeg:

Package Downloads
DataJuggler.RealESRGAN

Used with project Leonard, this library performs 4× image upscaling using Vulkan-based Real-ESRGAN. Call UpscaleImage with an input image, output path, and model to generate high-quality results.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.5 150 8/4/2025
1.0.4 43 8/2/2025
1.0.3 124 7/30/2025
1.0.2 120 7/29/2025
1.0.1 113 7/29/2025
1.0.0 120 7/29/2025