Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Could not load type 'FFmpeg.AutoGen.Native.LibraryLoader' from assembly 'FFmpeg.AutoGen #679

Open
1 task
saulgreenberg opened this issue Nov 23, 2024 · 7 comments

Comments

@saulgreenberg
Copy link

I am considering FFME as an alternate to MediaElement, but can't get it to run correctly.
I wrote a minimal .Net 4.8.2 FFME test project constructed according to the instructions, ie.,

  • placing ffmpeg shared binaries in a folder,
  • setting the Unosquare.FFME.Library.FFmpegDirector to that folder,
  • creating an ffme:MediaElement in a grid,
  • doing a Media.Open on a video
    However, it generates this error message:
    Could not load type 'FFmpeg.AutoGen.Native.LibraryLoader' from assembly 'FFmpeg.AutoGen, Version=6.0.0.2, Culture=neutral, PublicKeyToken=9b7632533a381715'.

The ffmpeg binaries are numbered as follows, in case this is due to an incompatability with the ffmpeg libraries (although I have also tried with other ffmpeg libraries)
avcodec-61.dll
avdevice-61.dll
avfilter-10.dll
avformat-61.dll
avutil-59.dll
postproc-58.dll
swresample-5.dll
swscale-8.dll
(plus ffmpeg.exe, ffplaye.exe, ffprobe.exe)

Issue Categories

  • [ X] Bug

Version Information

  • NuGet Package .4.4350

Steps to Reproduce

I can package up the entire project as a zip file if desired. It really is a minimal application that jsut attempts to play a single video.

@MrBean2016
Copy link
Contributor

MrBean2016 commented Nov 24, 2024

What if you test the loader directly and go from there?
Other things to test.
Is ffmpeg.exe working from the command line?
Try to set the build to x64
And it has to be an exact match between the version of FFmpeg and FFmpeg.AutoGen

using FFmpeg.Loader;

FFmpegLoader.SearchPaths(@"C:\ffmpeg-n6.0-win64-lgpl-shared-6.0\bin").Load();

@saulgreenberg
Copy link
Author

saulgreenberg commented Nov 24, 2024 via email

@MrBean2016
Copy link
Contributor

I think I understand the problem. The author has not published any new NuGet packages since 2021, but the source code has been updated. If you try to use the published NuGet package, it will be outdated.

To resolve this, you need to clone the repository, build the solution, and obtain the ffme.win.dll assembly. Then, place it in your application's directory and reference it. You should target .NET rather than .NET Framework.

If you clone the repository, there is a working sample application included that you can study:
https://github.com/unosquare/ffmediaelement/tree/master/Unosquare.FFME.Windows.Sample

The FFmpeg binaries can be found here:
https://ffmpeg.org/download.html

That page will link to a few build repositories, such as:
https://github.com/BtbN/FFmpeg-Builds/releases
This particular build works with FFMediaElement:
ffmpeg-n6.1-latest-win64-gpl-shared-6.1.zip

Note: FFmpeg version 7 is not supported.

@saulgreenberg
Copy link
Author

saulgreenberg commented Nov 24, 2024 via email

@MrBean2016
Copy link
Contributor

MrBean2016 commented Nov 25, 2024

I guess you need to check-out an earlier commit from when .Net Framework was supported but I think the smartest choice is to look into another library that still has support for .Net Framework like https://github.com/videolan/libvlcsharp

And if it is to be integrated into a commercial application, be sure to read the license. FFmpeg includes some components that are licensed under the GPL.

@MLXProjects
Copy link

I had the same issue on my WPF app targetting .net 4.6.1, solved it and my current config is:

  • FFME.Windows NuGet package version 4.4.350
  • FFMPEG.AutoGen NuGet package version 4.4.1.1
  • FFMPEG build 4.4.4-94-win64-gpl-shared

4.4.4 64-bit builds can be found at https://github.com/BtbN/FFmpeg-Builds/releases/tag/autobuild-2024-03-31-17-28
If targetting 32-bit, you can use https://github.com/defisym/FFmpeg-Builds-Win32/releases/tag/autobuild-2024-03-31-12-42

@saulgreenberg
Copy link
Author

saulgreenberg commented Nov 28, 2024 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants