sdcb / Sdcb.FFmpeg

FFmpeg basic .NET API generated by CppSharp
GNU Lesser General Public License v3.0
334 stars 53 forks source link

linuxarm64 #21

Closed sunkunGitHub closed 2 months ago

sunkunGitHub commented 3 months ago

怎么打linuxarm64的包?目前Sdcb.FFmpeg.runtime.windows-x64只能在windows环境下运行,linux下会报错 fail: Microsoft.Extensions.Hosting.Internal.Host[11] Hosting failed to start System.DllNotFoundException: Unable to load shared library 'libavformat.so.61' or one of its dependencies. In order to help diagnose loading problems, consider setting the LD_DEBUG environment variable: liblibavformat.so.61: cannot open shared object file: No such file or directory at System.Runtime.InteropServices.NativeLibrary.LoadByName(String libraryName, QCallAssembly callingAssembly, Boolean hasDllImportSearchPathFlag, UInt32 dllImportSearchPathFlag, Boolean throwOnError) at System.Runtime.InteropServices.NativeLibrary.LoadLibraryByName(String libraryName, Assembly assembly, Nullable1 searchPath, Boolean throwOnError) at System.Runtime.InteropServices.NativeLibrary.Load(String libraryName, Assembly assembly, Nullable1 searchPath) at Sdcb.FFmpeg.Raw.ffmpeg.DllImportResolver(String libraryName, Assembly assembly, Nullable1 searchPath) at System.Runtime.InteropServices.NativeLibrary.LoadLibraryCallbackStub(String libraryName, Assembly assembly, Boolean hasDllImportSearchPathFlags, UInt32 dllImportSearchPathFlags) at Sdcb.FFmpeg.Raw.ffmpeg.avformat_open_input(AVFormatContext** ps, String url, AVInputFormat* fmt, AVDictionary** options) at VideoHandleTest.VideoHandleService.ExecuteAsync(CancellationToken stoppingToken) in C:\Users\Administrator\Desktop\VideoHandleTest\VideoHandleService.cs:line 20 at Microsoft.Extensions.Hosting.Internal.Host.<StartAsync>b__15_1(IHostedService service, CancellationToken token) at Microsoft.Extensions.Hosting.Internal.Host.ForeachService[T](IEnumerable1 services, CancellationToken token, Boolean concurrent, Boolean abortOnFirstException, List1 exceptions, Func3 operation) Unhandled exception. System.DllNotFoundException: Unable to load shared library 'libavformat.so.61' or one of its dependencies. In order to help diagnose loading problems, consider setting the LD_DEBUG environment variable: liblibavformat.so.61: cannot open shared object file: No such file or directory at System.Runtime.InteropServices.NativeLibrary.LoadByName(String libraryName, QCallAssembly callingAssembly, Boolean hasDllImportSearchPathFlag, UInt32 dllImportSearchPathFlag, Boolean throwOnError) at System.Runtime.InteropServices.NativeLibrary.LoadLibraryByName(String libraryName, Assembly assembly, Nullable1 searchPath, Boolean throwOnError) at System.Runtime.InteropServices.NativeLibrary.Load(String libraryName, Assembly assembly, Nullable1 searchPath) at Sdcb.FFmpeg.Raw.ffmpeg.DllImportResolver(String libraryName, Assembly assembly, Nullable1 searchPath) at System.Runtime.InteropServices.NativeLibrary.LoadLibraryCallbackStub(String libraryName, Assembly assembly, Boolean hasDllImportSearchPathFlags, UInt32 dllImportSearchPathFlags) at Sdcb.FFmpeg.Raw.ffmpeg.avformat_open_input(AVFormatContext** ps, String url, AVInputFormat* fmt, AVDictionary** options) at VideoHandleTest.VideoHandleService.ExecuteAsync(CancellationToken stoppingToken) in C:\Users\Administrator\Desktop\VideoHandleTest\VideoHandleService.cs:line 20 at Microsoft.Extensions.Hosting.Internal.Host.<StartAsync>b__15_1(IHostedService service, CancellationToken token) at Microsoft.Extensions.Hosting.Internal.Host.ForeachService[T](IEnumerable1 services, CancellationToken token, Boolean concurrent, Boolean abortOnFirstException, List1 exceptions, Func3 operation) at Microsoft.Extensions.Hosting.Internal.Host.g__LogAndRethrow|15_3(<>c__DisplayClass15_0& ) at Microsoft.Extensions.Hosting.Internal.Host.StartAsync(CancellationToken cancellationToken) at Microsoft.Extensions.Hosting.HostingAbstractionsHostExtensions.RunAsync(IHost host, CancellationToken token) at Microsoft.Extensions.Hosting.HostingAbstractionsHostExtensions.RunAsync(IHost host, CancellationToken token) at VideoHandleTest.Program.Main(String[] args) in C:\Users\Administrator\Desktop\VideoHandleTest\Program.cs:line 18 at VideoHandleTest.Program.

(String[] args) 已放弃 (核心已转储)

sdcb commented 3 months ago

你不需要打这个包,因为Linux上你直接apt install去安装对应版本的ffmpeg就行了

sunkunGitHub commented 3 months ago

ok ,感谢,我去试试

sunkunGitHub commented 3 months ago

我使用sudo yum -y install ffmpeg之后,在终端可以识别ffmpeg命令了,但是我运行程序还是报上面的错,请问是什么原因?

sdcb commented 3 months ago

这样装: https://github.com/sdcb/Sdcb.FFmpeg?tab=readme-ov-file#install

不同的ffmpeg版本安装方式不一样,你可以选择正确的版本。

sunkunGitHub commented 3 months ago

我的系统是 Kylin Linux Advanced Server release V10 (Lance)

Kernel: 4.19.90-52.22.v2207.ky10.aarch64

Build: Kylin Linux Advanced Server release V10 (SP3) /(Lance)-aarch64-Build23/20230324 好像用不了apt, 我看了下ffmpeg是ffmpeg version 4.0.2 Copyright (c) 2000-2018 the FFmpeg developers ,是不是因为版本太低了导致报错

sdcb commented 3 months ago

可以使用Sdcb.FFmpeg 4.x的版本试试,不用最新版 如果要装新版本,Kylin服务器版可能是基于CentOS的,你可能试试dnf或者yum命令,或者网上查查

sunkunGitHub commented 3 months ago

好的,懂了,非常感谢