FFMpegCore/FFMpegCore/Extend/BitmapExtensions.cs

23 lines
584 B
C#
Raw Normal View History

2019-02-08 11:19:40 +01:00
using System;
using System.Drawing;
using System.IO;
namespace FFMpegCore.Extend
{
public static class BitmapExtensions
{
public static bool AddAudio(this Image poster, string audio, string output)
2019-02-08 11:19:40 +01:00
{
var destination = $"{Environment.TickCount}.png";
poster.Save(destination);
try
{
2020-05-08 11:07:51 +02:00
return FFMpeg.PosterWithAudio(destination, audio, output);
2019-02-08 11:19:40 +01:00
}
finally
{
2020-05-08 11:07:51 +02:00
if (File.Exists(destination)) File.Delete(destination);
2019-02-08 11:19:40 +01:00
}
}
}
}