Winscripter.VideoEditingTools.dotnetVEE 1.1.0

Additional Details

This is now deprecated and no longer maintained for a few reasons: performance issues, compatibility with Blazor WebAssembly, and size (requires 258MB for ffmpeg/ffprobe). Additionally, I no longer write Video Editing tools because I only needed them for a short amount of time, but not anymore.

There is a newer version of this package available.
See the version list below for details.
dotnet add package Winscripter.VideoEditingTools.dotnetVEE --version 1.1.0                
NuGet\Install-Package Winscripter.VideoEditingTools.dotnetVEE -Version 1.1.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="Winscripter.VideoEditingTools.dotnetVEE" Version="1.1.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Winscripter.VideoEditingTools.dotnetVEE --version 1.1.0                
#r "nuget: Winscripter.VideoEditingTools.dotnetVEE, 1.1.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.
// Install Winscripter.VideoEditingTools.dotnetVEE as a Cake Addin
#addin nuget:?package=Winscripter.VideoEditingTools.dotnetVEE&version=1.1.0

// Install Winscripter.VideoEditingTools.dotnetVEE as a Cake Tool
#tool nuget:?package=Winscripter.VideoEditingTools.dotnetVEE&version=1.1.0                

dotnetVEE

Modern & Powerful Cross-Platform Managed Video Editing library for .NET that operates on FFmpeg/FFprobe; stands for .NET Video Editing Engine.

Compatibility

dotnetVEE runs on .NET 6 and .NET 8 only.

Documentation

Documentation can be found in the doc folder in the root of the GitHub repository.

Progressive Notification

A great feature of dotnetVEE is Progressive Notification, which is a way you pass ObservableCollection to a utility, and it will add values representing the percentage (how much data is processed) of the progress until it reaches 100%. This can help you build, for example, progress bars when using dotnetVEE in WPF, which is essential when it comes to creating video editors.

Documentation for Progressive Notification can be found here.

Examples

Obtaining information about a video:

using dotnetVEE;

Video video = Video.Load("adorable_cats.mp4");
Console.WriteLine($"FPS: {video.RoundedFPS}"); // 60
Console.WriteLine($"Total Frames: {video.FrameCount}"); // 3917
Console.WriteLine($"Resolution: {video.Resolution.X}x{video.Resolution.Y}"); // 1920x1080

Changing audio in a video between 2 timestamps (30%, default is 100%):

using dotnetVEE;
using dotnetVEE.Abstractions;
using dotnetVEE.Computation.Audio;

Video vid = Video.Create("seagulls.mp4");

AudioManager.AlterVolume(
    vid,
    new StartEndTimestamp(new TimeSpan(0, 0, 0, 1), new TimeSpan(0, 0, 0, 6)),
    new Volume(30F),
    "seagulls-silentpart.mp4");

Extracting audio from a video:

using dotnetVEE;
using dotnetVEE.Computation.Audio;

Video vid = Video.Create("seagulls.mp4");

AudioKind? kind = AudioManager.AutomatedExtractAudio(vid, "audio.mp3");
if (kind is null)
{
    Console.WriteLine("The audio format of the video is unsupported.");
}
else
{
    Console.WriteLine($"The audio type is {kind?.ToString()}");
}

Glitch effect:

using dotnetVEE;
using dotnetVEE.Abstractions;
using dotnetVEE.Abstractions.FileGeneration;
using dotnetVEE.Computation.Utils;
using System.Collections.ObjectModel;

Video video = Video.Create("seagulls.mp4");

var progress = new ObservableCollection<float>();
progress.CollectionChanged += (s, e) =>
{
    int lastObj = (int)progress.Last();
    string pipes = new string('|', lastObj);

    if (lastObj > 100)
    {
        return;
    }

    string fmt = $"[{pipes.PadRight(100, ' ')}]";
    Console.WriteLine(fmt);
};

var config = new GlitchConfiguration(
    new StartEndTimestamp(new TimeSpan(0, 0, 0, 1, 500), new TimeSpan(0, 0, 0, 3)),
    0.05F,
    -20,
    20);

var eff = new GlitchEffect(config, DeleteGeneratedFiles.None);
eff.Run(video, ref progress);

Tweaking video speed by 3.5 times between two timestamps:

using dotnetVEE.Computation.Utils;
using System.Collections.ObjectModel;

Video video = Video.Create("seagulls.mp4");

var none = new ObservableCollection<float>();

Speed speed = new Speed(350F, new StartEndTimestamp(new TimeSpan(0, 0, 0, 1, 500), new TimeSpan(0, 0, 0, 7, 500)));
speed.Run(video, ref none);

Adding text to video:

using dotnetVEE;
using dotnetVEE.Abstractions;
using dotnetVEE.Computation.Options;
using dotnetVEE.Computation.Utils;
using SixLabors.Fonts;
using SixLabors.ImageSharp;
using SixLabors.ImageSharp.PixelFormats;
using System.Collections.ObjectModel;
using System.Collections.Specialized;

Video video = Video.Create("seagulls.mp4");

Font font = new FontCollection()
                .Add("SpaceGrotesk.ttf") // Add font file SpaceGrotesk.ttf- does not require the font to be installed
                .CreateFont(30F); // Make its size 30 pixels

var options = new TextComputationOptions(
    "Hello, World!",
    new Rgba32(0xFF, 0x00, 0x00) /* red RGB*/,
    new Point(128, 36),
    font);

var timestamp = new StartEndTimestamp(
    new TimeSpan(0, 0, 0, 1, 500),
    new TimeSpan(0, 0, 0, 3)); // the text will appear at 00:00:01.500 and will vanish at 00:00:03.000

bool leaveGeneratedFile = true; // set this to true if you don't want the original video to be overwrtiten.

IUtility util = new AddText(options, timestamp, leaveGeneratedFile);

var collection = new ObservableCollection<float>();
collection.CollectionChanged += (s, e) =>
{
    int lastObj = (int)collection.LastOrDefault();
    lastObj = lastObj > 100 ? 100 : lastObj;

    string contents = new string('|', lastObj).PadRight(100, ' ');
    Console.WriteLine($"[{contents}]");
};
util.Run(video, ref collection);
Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  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.

- Video class now contains the "ConcatenateWith" method, which adds a video to the end of another one
- dotnetVEE now supports GIF conversion with the GifConverter class
- dotnetVEE can now zoom in and out of a video using the Scale class
- removed redundant TODO in TextAppearanceUtility