You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

37 lines
1.2 KiB

using FFmpeg.AutoGen;
using System;
using System.IO;
using System.Runtime.InteropServices;
namespace EC.FFmpegAutoGen
{
public class FFmpegBinariesHelper
{
public static void RegisterFFmpegBinaries()
{
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
{
var current = Environment.CurrentDirectory;
var probe = Path.Combine("FFmpeg", "bin", Environment.Is64BitProcess ? "x64" : "x86");
while (current != null)
{
var ffmpegBinaryPath = Path.Combine(current, probe);
if (Directory.Exists(ffmpegBinaryPath))
{
Console.WriteLine($"FFmpeg binaries found in: {ffmpegBinaryPath}");
ffmpeg.RootPath = ffmpegBinaryPath;
return;
}
current = Directory.GetParent(current)?.FullName;
}
}
else if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
ffmpeg.RootPath = "/lib/x86_64-linux-gnu/";
else
throw new NotSupportedException(); // fell free add support for platform of your choose
}
}
}