ZZMpeg 1.0.3

There is a newer version of this package available.
See the version list below for details.
Install-Package ZZMpeg -Version 1.0.3
dotnet add package ZZMpeg --version 1.0.3
<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
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: ZZMpeg, 1.0.3"
#r directive can be used in F# Interactive, C# scripting and .NET Interactive. 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
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

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();
    }
}

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 499 9/26/2018
1.0.3 712 2/1/2018
1.0.2 542 12/14/2017