gpt4 book ai didi

c# - 在 Mono/Linux 中使用 FFmpeg.Autogen 4.1.0.2 时找不到 Kernel32

转载 作者:太空宇宙 更新时间:2023-11-03 12:05:10 30 4
gpt4 key购买 nike

我在发布这个时提交了一个错误报告,我不知道我可以从堆栈跟踪中看到 FFmpeg.Autogen。不管怎样,我在 Github 上发布了错误报告

https://github.com/Ruslan-B/FFmpeg.AutoGen/issues/109

我正在尝试在使用 FFmpeg.Autogen 与 ffmpeg 库交互的 Linux 中运行我的代码。我越来越找不到 kernel32 dll 无法弄清楚为什么。他说不要将问题发布到 github 进行故障排除。可能的相关问题:https://github.com/Ruslan-B/FFmpeg.AutoGen/issues/89

我尝试的第一件事是从我稍微调整过的示例代码中包含二进制帮助器类。添加了 linux 文件的确切路径。我做的第二件事是添加 FFmpeg.AutoGen.dll.config 如果配置正确,它会尝试引用一个 Windows DLL,它应该指向 Linux DLL。堆栈跟踪:

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

我触发这个的代码:

Format = ffmpeg.avformat_alloc_context();

Binaryhelper 应该为文件正确设置路径

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;
}
}

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 说他会修好它。

在应用修复程序后,它基本上可以正常工作,我想我只是看不到视频,因为我使用的色彩空间对于 linux 来说是错误的,这是我的猜测。音频工作正常。

但是这个问题已经关闭了。

Elgonzo 在评论中帮助指出正确的问题不是库加载失败。那就是 FFmpeg.Autogen 使用了错误的仅限 Windows 的函数。

关于c# - 在 Mono/Linux 中使用 FFmpeg.Autogen 4.1.0.2 时找不到 Kernel32,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55405051/

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com