FFMpegCore/FFMpegCore.Extensions.System.Drawing.Common/BitmapExtensions.cs

25 lines
636 B
C#
Raw Permalink Normal View History

using System.Drawing;
namespace FFMpegCore.Extensions.System.Drawing.Common
{
public static class BitmapExtensions
{
public static bool AddAudio(this Image poster, string audio, string output)
{
var destination = $"{Environment.TickCount}.png";
poster.Save(destination);
try
{
return FFMpeg.PosterWithAudio(destination, audio, output);
}
finally
{
if (File.Exists(destination))
{
File.Delete(destination);
}
}
}
}
}