A lightweight & extentable wrapper of FFmpeg.
I used FFmpeg.NET as my media lib, but it is not that good as I thought. So I made FFmpegLite.NET, major parts token from FFmpeg.NET, but has more features
- clear arguments with task (groupped by convert/get thumbnail/get metadata)
- easy to extend by adding extra command
- merge PR in-time 😄
Important: It is still in pre-release stage, recommend to use from v1.0.
- Use fluent syntax
- Easy to extend
Package | NuGet |
---|---|
FFmpegLite.NET |
Install FFmpegLite.NET from nuget.org Package Source using the Package Manager Console with the following command
PM> Install-Package FFmpegLite.NET
// set default enviroment for Windows OS
FFmpegEnviroment.SetPath(@"C:\ffmpeg\bin\ffmpeg.exe"); // linux/ubuntu with ffmpeg installed just skip this step
// convert video
var convertResult = await new FFmpegConvertTask()
.FromFile(@"C:\Path\To_Video.flv") // set input file
.Resize(null, 720) // set output frame size
.AppendExtraCommand(" -movflags +faststart ") // can add extra arguments
.ConvertAsync("NewVideo.mp4"); // start task
// get thumbnail
var thumbailFile = await new FFmpegThumbnailTask()
.FromFile("video.mp4")
.GetThumbnailAsync("thumbnail.jpg");
// get meta data
var metadata = await new FFmpegMetadataTask()
.FromFile("video.mp4")
.GetMetadataAsync();
It is very easy to extend this lib.
var convertResult = await new FFmpegConvertTask(ffmpeg)
.FromFile(@"C:\Path\To_Video.flv")
.AppendExtraCommand(" -movflags +faststart ") // can add extra arguments
.ConvertAsync("NewVideo.mp4");
public static class MyFFmpegLiteExtension
{
public static FFmpegConvertTask UseFaststartFlags(this FFmpegConvertTask convertTask)
{
return convertTask.AppendExtraCommand(" -movflags +faststart ");
}
}
var rst = await new FFmpegConvertTask()
.FromFile(@"C:\Path\To_Video.flv")
.UseFaststartFlags()
.ConvertAsync("NewVideo.mp4");
You are encouraged to contribute this project by
- Report issues
- Submit requests
- PR