2023-02-02 20:19:45 +00:00
|
|
|
|
using System.Drawing;
|
2019-02-08 10:19:40 +00:00
|
|
|
|
|
2022-03-24 19:19:37 +00:00
|
|
|
|
namespace FFMpegCore.Extensions.System.Drawing.Common
|
2019-02-08 10:19:40 +00:00
|
|
|
|
{
|
|
|
|
|
public static class BitmapExtensions
|
|
|
|
|
{
|
2021-03-15 21:48:43 +00:00
|
|
|
|
public static bool AddAudio(this Image poster, string audio, string output)
|
2019-02-08 10:19:40 +00:00
|
|
|
|
{
|
|
|
|
|
var destination = $"{Environment.TickCount}.png";
|
|
|
|
|
poster.Save(destination);
|
|
|
|
|
try
|
|
|
|
|
{
|
2023-02-02 20:19:45 +00:00
|
|
|
|
return FFMpeg.PosterWithAudio(destination, audio, output);
|
2019-02-08 10:19:40 +00:00
|
|
|
|
}
|
|
|
|
|
finally
|
|
|
|
|
{
|
2023-02-02 20:19:45 +00:00
|
|
|
|
if (File.Exists(destination))
|
|
|
|
|
{
|
|
|
|
|
File.Delete(destination);
|
|
|
|
|
}
|
2019-02-08 10:19:40 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2023-02-02 20:19:45 +00:00
|
|
|
|
}
|