FFMpeg_Wrapper 1.2.7

dotnet add package FFMpeg_Wrapper --version 1.2.7                
NuGet\Install-Package FFMpeg_Wrapper -Version 1.2.7                
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="FFMpeg_Wrapper" Version="1.2.7" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add FFMpeg_Wrapper --version 1.2.7                
#r "nuget: FFMpeg_Wrapper, 1.2.7"                
#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.
// Install FFMpeg_Wrapper as a Cake Addin
#addin nuget:?package=FFMpeg_Wrapper&version=1.2.7

// Install FFMpeg_Wrapper as a Cake Tool
#tool nuget:?package=FFMpeg_Wrapper&version=1.2.7                

FFMpeg-Wrapper

A wrapper for FFMpeg CLI for ease-of-use when running commands.

NuGet Version NuGet Downloads GitHub issues GitHub stars GitHub GitHub code contributors

Features

  • one
  • two

Example

This example uses most of the major features of the wrapper. It runs FFMpeg command using the PATH environment variable to find the .exe file.

using FFMpeg_Wrapper;
using FFMpeg_Wrapper.Codecs;
using FFMpeg_Wrapper.ffprobe;
using Iso639;

// Run FFProbe on the input to determine what streams are available for processing.
MediaAnalysis? input = new FFProbe().Analyse(@"C:\Users\Zach\Downloads\VTS_02_1.VOB");
if (input == null)
{
    Console.ForegroundColor = ConsoleColor.Red;
    Console.WriteLine("Failed to read input file!");
    Console.ResetColor();
    return;
}

// This creates a new instance by finding the .exe in the PATH environment variable
// Optionally you can pass it the ffmpeg.exe path directly
FFMpeg ffmpeg = new();

// Creates the necessary command line arguments for FFMpeg. The arguments themselves are
// invisible to the user, and only a higher-level understanding of how the streams should be
// remuxed is required.
var arguments = ffmpeg.Transcode(@"C:\Users\Zach\Downloads\Test.mp4") // Start a transcode command and set our desired output file
    .AddVideoStreams( // Add all video streams
        input, // getting the streams from our only input file
        new VideoStreamOptions() 
			.SetCodec(Codecs.Libx264.SetCRF(16))) // use the libx264 transcoder with -crf 16
    .AddAudioStream( // Add a single audio stream
        input.AudioStreams[0], // Select the first stream from our only input file
        new AudioStreamOptions() 
			.SetCodec(Codecs.AAC) // Use the AAC codec
			.SetLanguage(Language.FromPart2("eng"))); // Tag the track language as "English"

// Now run the FFMpeg arguments on the command line
bool result = arguments
    .NotifyOnProgress((double percent) =>
    {
        // This gets ran when the percentage completion is updated.
        // Useful for using IProgress<> in UI applications or async operation
        Console.WriteLine($"Progress: {percent:0}%");
    })
    .SetLogPath(@"C:\Users\Zach\Downloads\TestLog.txt") // Set optional log path. Will print the full command ran, the FFMpeg output, and the exit code or exception of the process.
    .SetOverwrite(false) // Defaults to true, when false the program will exit with an error if the output file already exists.
    .Run(); // Blocking call to run the command. Use RunAsync() for an async call.

// Check the result of the command
if (!result)
{
    Console.ForegroundColor = ConsoleColor.Red;
    Console.WriteLine("FFMpeg encountered an error!");
    Console.ResetColor();
    return;
}
Console.WriteLine("Success!");

// Example of getting a screenshot at a specific frame or time
// Same general layout, except the .Snapshot() function already creates all the arguments,
// so the only thing left to configure is log path, overwrite, or NotifyOnProgress (same as previous example)
int frameIndex = 0;
var snapshotArgs = ffmpeg.Snapshot(@"C:\Users\Zach\Downloads\Test.mp4", frameIndex, @"C:\Users\Zach\Downloads\Snapshot_frame_0.png");
snapshotArgs.Run();
Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.2.7 85 12/18/2024
1.2.6 72 12/18/2024
1.2.5 69 12/17/2024
1.2.4 61 12/17/2024
1.2.3 75 12/17/2024
1.2.2 68 12/17/2024
1.2.1 63 12/17/2024
1.2.0 76 12/16/2024
1.1.3 72 12/15/2024
1.1.2 71 12/14/2024
1.1.1 68 12/14/2024
1.1.0 73 12/14/2024
1.0.7 81 12/13/2024
1.0.6 85 12/10/2024
1.0.5 80 12/10/2024
1.0.4 85 12/9/2024
1.0.3 78 12/9/2024
1.0.2 87 12/9/2024
1.0.1 86 12/9/2024
1.0.0 82 12/9/2024

Added more scaling options