I'm porting an XNA 3.1 game to MonoGame and found this project to be able to play videos.
When trying to run the demo from this repository, I encountered an error at runtime:
Exception has occurred: CLR/System.DllNotFoundException
An unhandled exception of type 'System.DllNotFoundException' occurred in System.Private.CoreLib.dll: 'Unable to load DLL 'avutil-57' or one of its dependencies: The specified module could not be found. (0x8007007E)'
I have ffmpeg 5.1.2 installed on Windows 11 through winget, running with dotnet 9.
The exception is being thrown on this line:
// ./Sources/MonoGame.Extended.VideoPlayback/FFmpegBinariesHelper.cs:21
var ver = ffmpeg.av_version_info();
On WSL2, Ubuntu 22.04, with ffmpeg 5.1.7 installed through linuxbrew, I get a similar error:
❯ dotnet run --project Demos/Demo.VideoPlayback.DesktopGL
Unhandled exception. System.DllNotFoundException: Unable to load shared library 'libavutil.so.57' or one of its dependencies. In order to help diagnose loading problems, consider using a tool like strace. If you're using glibc, consider setting the LD_DEBUG environment variable:
/home/rcdmk/Projects/MonoGame.Extended2/Demos/Demo.VideoPlayback.DesktopGL/bin/DesktopGL/AnyCPU/Debug/net9.0/runtimes/linux-x64/native/libavutil.so.57: cannot open shared object file: No such file or directory
/home/linuxbrew/.linuxbrew/Cellar/dotnet/9.0.8/libexec/shared/Microsoft.NETCore.App/9.0.8/libavutil.so.57: cannot open shared object file: No such file or directory
/home/rcdmk/Projects/MonoGame.Extended2/Demos/Demo.VideoPlayback.DesktopGL/bin/DesktopGL/AnyCPU/Debug/net9.0/libavutil.so.57: cannot open shared object file: No such file or directory
/home/rcdmk/Projects/MonoGame.Extended2/Demos/Demo.VideoPlayback.DesktopGL/bin/DesktopGL/AnyCPU/Debug/net9.0/runtimes/linux-x64/native/liblibavutil.so.57: cannot open shared object file: No such file or directory
/home/linuxbrew/.linuxbrew/Cellar/dotnet/9.0.8/libexec/shared/Microsoft.NETCore.App/9.0.8/liblibavutil.so.57: cannot open shared object file: No such file or directory
/home/rcdmk/Projects/MonoGame.Extended2/Demos/Demo.VideoPlayback.DesktopGL/bin/DesktopGL/AnyCPU/Debug/net9.0/liblibavutil.so.57: cannot open shared object file: No such file or directory
/home/rcdmk/Projects/MonoGame.Extended2/Demos/Demo.VideoPlayback.DesktopGL/bin/DesktopGL/AnyCPU/Debug/net9.0/runtimes/linux-x64/native/libavutil.so.57.so: cannot open shared object file: No such file or directory
/home/linuxbrew/.linuxbrew/Cellar/dotnet/9.0.8/libexec/shared/Microsoft.NETCore.App/9.0.8/libavutil.so.57.so: cannot open shared object file: No such file or directory
/home/rcdmk/Projects/MonoGame.Extended2/Demos/Demo.VideoPlayback.DesktopGL/bin/DesktopGL/AnyCPU/Debug/net9.0/libavutil.so.57.so: cannot open shared object file: No such file or directory
/home/rcdmk/Projects/MonoGame.Extended2/Demos/Demo.VideoPlayback.DesktopGL/bin/DesktopGL/AnyCPU/Debug/net9.0/runtimes/linux-x64/native/liblibavutil.so.57.so: cannot open shared object file: No such file or directory
/home/linuxbrew/.linuxbrew/Cellar/dotnet/9.0.8/libexec/shared/Microsoft.NETCore.App/9.0.8/liblibavutil.so.57.so: cannot open shared object file: No such file or directory
/home/rcdmk/Projects/MonoGame.Extended2/Demos/Demo.VideoPlayback.DesktopGL/bin/DesktopGL/AnyCPU/Debug/net9.0/liblibavutil.so.57.so: cannot open shared object file: No such file or directory
at System.Runtime.InteropServices.NativeLibrary.LoadLibraryByName(String libraryName, Assembly assembly, Nullable`1 searchPath, Boolean throwOnError)
at Sdcb.FFmpeg.Raw.ffmpeg.DllImportResolver(String libraryName, Assembly assembly, Nullable`1 searchPath)
at System.Runtime.InteropServices.NativeLibrary.LoadLibraryCallbackStub(String libraryName, Assembly assembly, Boolean hasDllImportSearchPathFlags, UInt32 dllImportSearchPathFlags)
at Sdcb.FFmpeg.Raw.ffmpeg.av_version_info()
at MonoGame.Extended.VideoPlayback.FFmpegBinariesHelper.InitializeFFmpeg() in /home/rcdmk/Projects/MonoGame.Extended2/Sources/MonoGame.Extended.VideoPlayback/FFmpegBinariesHelper.cs:line 21
at Demo.VideoPlayback.DesktopGL.Program.Main() in /home/rcdmk/Projects/MonoGame.Extended2/Demos/Demo.VideoPlayback.DesktopGL/Program.cs:line 18
I'm porting an XNA 3.1 game to MonoGame and found this project to be able to play videos.
When trying to run the demo from this repository, I encountered an error at runtime:
I have ffmpeg 5.1.2 installed on Windows 11 through winget, running with dotnet 9.
The exception is being thrown on this line:
On WSL2, Ubuntu 22.04, with ffmpeg 5.1.7 installed through linuxbrew, I get a similar error: