using Chase.FFmpeg.Converters;
using Chase.FFmpeg.Info;
using Chase.FFmpeg.Events;
using Chase.FFmpeg;
FFMediaInfo info = new FFMediaInfo("/path/to/media.mkv");
FFMuxedConverter converter = FFMuxedConverter.SetMedia(info)
.ChangeVideoCodec("h264_nvenc")
.ChangeVideoBitrate("2M")
.ChangeAudioCodec("aac")
.ChangeAudioBitrate("200K")
.ChangeHardwareAccelerationMethod()
.ChangePixelFormat("y2k")
.ChangeResolution(800, 600)
.ChangeWidth(800)
.ChangeHeight(600)
.ChangeStartPosition("00:00:00")
.ChangeVideoDuration("00:15:00")
.OverwriteOriginal();
/// 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;
};
.Convert("/path/to/output.mkv", data_handler, exited, updated);
.Build("/path/to/output.mkv")
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);
This downloads the ffmpeg library.
using Chase.FFmpeg.Downloader;
/// Downloads the latest version of FFmpeg
FFmpegDownloader.Instance.GetLatest("/path/to/ffmpeg").Wait(); // Async Process
/// Path to ffmpeg executable
string ffmpeg = FFmpegDownloader.Instance.FFmpegExecutable; // path/to/ffmpeg/ffmpeg.exe
/// Path to ffprobe executable
string ffprobe = FFmpegDownloader.Instance.FFprobeExecutable; // path/to/ffmpeg/ffprobe.exe
/// The installed ffmpeg version
string version = FFmpegDownloader.Instance.FFmpegVersion; // 4.0.1
using Chase.FFmpeg.Extras;
/// <param name="path">The starting path</param>
/// <param name="recursive">If the search should look through all subdirectories</param>
FFVideoUtility.GetFiles("path/to/files", true)
FFVideoUtility.video_extensions
Checks if file has a extension matching the Video Extensions array
FFVideoUtility.HasVideoExtension("/path/to/video.mkv")
/// <param name="path">The starting path</param>
/// <param name="recursive">If the search should look through all subdirectories</param>
FFAudioUtility.GetFiles("path/to/files", true)
FFAudioUtility.audio_extensions
Checks if file has a extension matching the Audio Extensions array
FFAudioUtility.HasAudioExtension("/path/to/audio.mp3")
/// <param name="path">The starting path</param>
/// <param name="recursive">If the search should look through all subdirectories</param>
FFImagesUtility.GetFiles("path/to/files", true)
FFImagesUtility.images_extensions
Checks if file has a extension matching the Images Extensions array
FFImagesUtility.HasImagesExtension("/path/to/images.mp3")