Chase.FFmpeg 0.1.0

dotnet add package Chase.FFmpeg --version 0.1.0
                    
NuGet\Install-Package Chase.FFmpeg -Version 0.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="Chase.FFmpeg" Version="0.1.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Chase.FFmpeg" Version="0.1.0" />
                    
Directory.Packages.props
<PackageReference Include="Chase.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 Chase.FFmpeg --version 0.1.0
                    
#r "nuget: Chase.FFmpeg, 0.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.
#:package Chase.FFmpeg@0.1.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=Chase.FFmpeg&version=0.1.0
                    
Install as a Cake Addin
#tool nuget:?package=Chase.FFmpeg&version=0.1.0
                    
Install as a Cake Tool

Chase.FFmpeg

Using Statements

using Chase.FFmpeg.Converters;
using Chase.FFmpeg.Info;
using Chase.FFmpeg.Events;
using Chase.FFmpeg;

Create media info object

FFMediaInfo info = new FFMediaInfo("/path/to/media.mkv");

Create Muxed converter

FFMuxedConverter converter = FFMuxedConverter.SetMedia(info)

Muxed converter options

Changes the video codec

.ChangeVideoCodec("h264_nvenc")

Changes the video bitrate

.ChangeVideoBitrate("2M")

Changes the audio codec

.ChangeAudioCodec("aac")

Changes the audio bitrate

.ChangeAudioBitrate("200K")

Changes the hardware acceleration method

.ChangeHardwareAccelerationMethod()

Changes the pixel format of the video

.ChangePixelFormat("y2k")

Changes the width and height of the video stream

.ChangeResolution(800, 600)

Changes the width of the video while maintaining aspect ratio

.ChangeWidth(800)

Changes the height of the video while maintaining aspect ratio

.ChangeHeight(600)

The position that the video starts at

.ChangeStartPosition("00:00:00")

Changes the duration of the video

.ChangeVideoDuration("00:15:00")

Overwrites output file if one exists

.OverwriteOriginal();

Events

/// The console output of ffmpeg
DataReceivedEventHandler? data_handler = (object s, DataReceivedEventArgs e) => { };

/// Runs when ffmpeg exists
EventHandler exited = (object sender, EventArgs e) => { };

/// Returns ffmpeg update values
EventHandler<FFProcessUpdateEventArgs> updated = (object sender, FFProcessUpdateEventArgs e) =>
{
    /// The bitrate that the video is being processed at
    float bitrate = e.AverageBitrate;

    /// The number of frames already processed
    uint frames = e.FramesProcessed;

    /// The percentage of the video has been processed
    float percentage = e.Percentage;

    /// The speed that the video is processing at
    float speed = e.Speed;
};

Converts the current Muxed Converter

.Convert("/path/to/output.mkv", data_handler, exited, updated);

Builds a ffmpeg argument string

.Build("/path/to/output.mkv")

Example

string argument = FFMuxedConverter
    .SetMedia(info)
    .ChangeVideoCodec("h264_nvenc")
    .ChangeVideoBitrate("2M")
    .ChangeHardwareAccelerationMethod()
    .ChangeResolution(800, 600)
    .OverwriteOriginal()
    .Build("/path/to/output.mkv");
FFProcessHandler.ExecuteFFmpeg(argument, data_handler, exited, updated);
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.  net9.0 was computed.  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 Chase.FFmpeg:

Package Downloads
Chase.FFmpeg.Extra

Adds extra functionality to Chase.FFmpeg

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.1.0 657 11/26/2022
0.0.9 457 11/25/2022
0.0.8 679 11/20/2022
0.0.7 480 11/12/2022
0.0.6 485 11/12/2022
0.0.5 483 11/12/2022
0.0.4 487 11/12/2022
0.0.3 504 11/11/2022
0.0.2 519 11/11/2022
0.0.1 495 11/11/2022

Added check for if duration or frames are not present in the stream information