I'm submitting a bug report while I was posting this I didn't know I could see into FFmpeg.Autogen from the stacktrace. Anyways I posted a Bug Report on Github
I'm trying to run my code in Linux that uses FFmpeg.Autogen to interface with the ffmpeg libraries. I am getting kernel32 dll not found can not figure out why. He says to not post issues to github for troubleshooting. Possible related issue: https://github.com/Ruslan-B/FFmpeg.AutoGen/issues/89
First thing I've tried were to include the binary helper class from the example code I tweaked it a little bit. Added the exact path to the linux files. Second thing I did was add FFmpeg.AutoGen.dll.config if configured right and it tries to ref a windows DLL it should point to the linux one. Stacktrace:
System.DllNotFoundException: kernel32
at at (wrapper managed-to-native) FFmpeg.AutoGen.Native.WindowsNativeMethods.GetProcAddress(intptr,string)
at FFmpeg.AutoGen.Native.FunctionLoader.GetFunctionPointer (System.IntPtr nativeLibraryHandle, System.String functionName) [0x00000] in D:\FFmpeg.AutoGen\FFmpeg.AutoGen\Native\FunctionLoader.cs:55
at FFmpeg.AutoGen.Native.FunctionLoader.GetFunctionDelegate[T] (System.IntPtr nativeLibraryHandle, System.String functionName, System.Boolean throwOnError) [0x00000] in D:\FFmpeg.AutoGen\FFmpeg.AutoGen\Native\FunctionLoader.cs:28
at FFmpeg.AutoGen.ffmpeg.GetFunctionDelegate[T] (System.IntPtr libraryHandle, System.String functionName) [0x00000] in D:\FFmpeg.AutoGen\FFmpeg.AutoGen\FFmpeg.cs:50
at FFmpeg.AutoGen.ffmpeg+<>c.<.cctor>b__4_318 () [0x00000] in D:\FFmpeg.AutoGen\FFmpeg.AutoGen\FFmpeg.functions.export.g.cs:7163
at FFmpeg.AutoGen.ffmpeg.avformat_alloc_context () [0x00000] in D:\FFmpeg.AutoGen\FFmpeg.AutoGen\FFmpeg.functions.export.g.cs:7176
at FF8.FfccVaribleGroup..ctor () [0x0009c] in /home/robert/OpenVIII/FF8/FfccVaribleGroup.cs:53
at FF8.Ffcc..ctor (System.String filename, FFmpeg.AutoGen.AVMediaType mediatype, FF8.Ffcc+FfccMode mode) [0x00008] in /home/robert/OpenVIII/FF8/Ffcc.cs:31
at FF8.Module_movie_test.InitMovie () [0x00001] in /home/robert/OpenVIII/FF8/module_movie_test.cs:160
at FF8.Module_movie_test.Update () [0x000c5] in /home/robert/OpenVIII/FF8/module_movie_test.cs:88
at FF8.ModuleHandler.Update (Microsoft.Xna.Framework.GameTime gameTime) [0x000ac] in /home/robert/OpenVIII/FF8/ModuleHandler.cs:43
at FF8.Game1.Update (Microsoft.Xna.Framework.GameTime gameTime) [0x00030] in /home/robert/OpenVIII/FF8/Game1.cs:69
at Microsoft.Xna.Framework.Game.DoUpdate (Microsoft.Xna.Framework.GameTime gameTime) [0x00019] in <4fc8466c27384bb19c7b81b2a6a71083>:0
at Microsoft.Xna.Framework.Game.Tick () [0x00103] in <4fc8466c27384bb19c7b81b2a6a71083>:0
at Microsoft.Xna.Framework.SdlGamePlatform.RunLoop () [0x00021] in <4fc8466c27384bb19c7b81b2a6a71083>:0
at Microsoft.Xna.Framework.Game.Run (Microsoft.Xna.Framework.GameRunBehavior runBehavior) [0x0008b] in <4fc8466c27384bb19c7b81b2a6a71083>:0
at Microsoft.Xna.Framework.Game.Run () [0x0000c] in <4fc8466c27384bb19c7b81b2a6a71083>:0
at FF8.Program.Main () [0x00007] in /home/robert/OpenVIII/FF8/Program.cs:17
My code that triggers this:
Format = ffmpeg.avformat_alloc_context();
Binaryhelper should set the path correctly for the file
internal static void RegisterFFmpegBinaries()
{
var libraryPath = "";
switch (Environment.OSVersion.Platform)
{
case PlatformID.Win32NT:
case PlatformID.Win32S:
case PlatformID.Win32Windows:
var current = Environment.CurrentDirectory;
var probe = Path.Combine(Environment.Is64BitProcess ? "x64" : "x86");
while (current != null)
{
var ffmpegDirectory = Path.Combine(current, probe);
if (Directory.Exists(ffmpegDirectory))
{
Console.WriteLine($"FFmpeg binaries found in: {ffmpegDirectory}");
RegisterLibrariesSearchPath(ffmpegDirectory);
return;
}
current = Directory.GetParent(current)?.FullName;
}
break;
case PlatformID.Unix:
libraryPath = "/usr/lib/x86_64-linux-gnu";
RegisterLibrariesSearchPath(libraryPath);
break;
case PlatformID.MacOSX:
libraryPath = Environment.GetEnvironmentVariable(LD_LIBRARY_PATH);
RegisterLibrariesSearchPath(libraryPath);
break;
}
}
The FFmpeg.Autogen.dll.config
<configuration>
<dllmap os="linux" dll="avutil-56.dll" target="/usr/lib/x86_64-linux-gnu/libavutil.so.56"/>
<dllmap os="linux" dll="avcodec-58.dll" target="/usr/lib/x86_64-linux-gnu/libavcodec.so.58"/>
<dllmap os="linux" dll="avformat-58.dll" target="/usr/lib/x86_64-linux-gnu/libavformat.so.58"/>
<dllmap os="linux" dll="avdevice-58.dll" target="/usr/lib/x86_64-linux-gnu/libavdevice.so.58"/>
<dllmap os="linux" dll="avfilter-7.dll" target="/usr/lib/x86_64-linux-gnu/libavfilter.so.7"/>
<dllmap os="linux" dll="avresample-4.dll" target="/usr/lib/x86_64-linux-gnu/libavresample.so.4"/>
<dllmap os="linux" dll="swscale-5.dll" target="/usr/lib/x86_64-linux-gnu/libswscale.so.5"/>
<dllmap os="linux" dll="swresample-3.dll" target="/usr/lib/x86_64-linux-gnu/libswresample.so.3"/>
<dllmap os="linux" dll="postproc-55.dll" target="/usr/lib/x86_64-linux-gnu/libpostproc.so.55"/>
</configuration>
https://github.com/Ruslan-B/FFmpeg.AutoGen/issues/109#issuecomment-477756443
Ruslan-B said he's going to fix it.
After applying a fix it's mostly working I figure I'm only not seeing video because the colorspace i'm using is wrong for linux that's my guess. Audio is working fine.
But this issue is closed.
Elgonzo in comments helped point out the correct issue was not the libraries failing to load. And that it is that FFmpeg.Autogen is using the wrong windows-only function.