ZZMpeg 1.0.3

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

// Install ZZMpeg as a Cake Tool
#tool nuget:?package=ZZMpeg&version=1.0.3

ZZMpeg - highlevel wrapper for FFMpeg libraries (not ffmpeg binary) for WPF. Basic usage:

  1. Create an object FFMpeg
  2. Call FFMpeg.ExtractVideoFrame to get preview image from video
  3. Call FFMpeg.ConvertMediaFile to asynchronously convert video to other format
  4. Call FFMpeg.AssembleMediaFiles to asynchronously concat multiple input files into single output. They are concatinated in the same order they are specified in inputFiles array
  5. Call FFMpeg.SplitMediaFile to asynchronously split source media file into specified number of lesser files of equal duartion
  6. Call FFmpeg.SplitMediaFileWithTS to asynchronously split source media file into several lesser files based on specified timestamps array
  7. Call FFMpeg.ExtractMediaInfo to get media info from file

Example converting video:

public class ConvertOperation: INotifyPropertyChanged
{

 public enum ConvertionState
{
    Idle,
    Converting,
    Cancelling,
    Cancelled,
    Error,
    Done
}

    #region INPC implementation

    public event PropertyChangedEventHandler PropertyChanged;
    protected virtual void NotifyPropertyChanged(string propertyName)
    {
        PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
    }

    #endregion

    private string path;
    private string format;
    private string destPath;
    private CancellationTokenSource cTokenSource;
    private ConvertionState state;

    public string Name => Path.GetFileName(path);
    public BindableProgress<double> Progress { get; private set; }

    public ConvertionState State
    {
        get => state;
        set
        {
            state = value;
            NotifyPropertyChanged("State");
        }
    }

    public ConvertOperation(string filePath,string destPath, string destFormat)
    {
        path = filePath;
        this.destPath = destPath;
        format = destFormat;
        Progress = new BindableProgress<double>();
        cTokenSource = new CancellationTokenSource();
        State = ConvertionState.Idle;
    }

    public async Task Start()
    {
        State = ConvertionState.Converting;
        string outPath = Path.Combine(destPath, $"converted_{Path.GetFileNameWithoutExtension(path)}.{format}");

        try
        {
            using (var ffmpeg = new FFMpeg())
            {
                ffmpeg.EncoderParametersInit(out EncoderParameters parameters);
                parameters.AudioEncoder = AudioCodec.AAC.StringValue();
                await ffmpeg.ConvertMediaFile(path, outPath, parameters, Progress, cTokenSource.Token);;
                State = ConvertionState.Done;
            }
        }
        catch(TaskCanceledException)
        {
            State = ConvertionState.Cancelled;
        }
        catch(Exception ex)
        {
            State = ConvertionState.Error;
            Console.WriteLine($"Error converting file: {ex.Message}");
            MessageBox.Show($"Error converting file: {ex.Message}");
        }
    }

    public void Cancel()
    {
        if (State != ConvertionState.Converting)
            return;
        State = ConvertionState.Cancelling;
        cTokenSource.Cancel();
    }
}
Product Compatible and additional computed target framework versions.
.NET Framework net461 is compatible.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

This package has no dependencies.

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.0.4 1,147 9/26/2018
1.0.3 1,190 2/1/2018
1.0.2 892 12/14/2017