unosquare / ffmediaelement

FFME: The Advanced WPF MediaElement (based on FFmpeg)
https://unosquare.github.io/ffmediaelement/
Other
1.18k stars 244 forks source link

RetrieveMediaInfo fails to find binaries #450

Closed kealist closed 5 years ago

kealist commented 5 years ago

RetrieveMediaInfo Failure

A call to the RetrieveMediaInfo will give the error System.IO.FileNotFoundException: 'Unable to load FFmpeg binaries from folder... if a media element has not been shown yet. I have the path to the binaries set on startup, but I have to open a video (or at least have a visible player) before I am able to get media info on another.

var info = Library.RetrieveMediaInfo(Path.GetFullPath(destinationPath));

Issue Categories

Version Information

Steps to Reproduce

  1. Set path to ffmpeg libs
    1. Call Library.RetrieveMediaInfo
kealist commented 5 years ago

I found the example of loading on startup to resolve this, but something should probably trigger it automatically

Task.Run(async () =>
            {
                try
                {
                    // Pre-load FFmpeg
                    await Library.LoadFFmpegAsync();
                }
                catch (Exception ex)
                {
                    await Current?.Dispatcher?.BeginInvoke(new Action(() =>
                    {
                        MessageBox.Show(MainWindow,
                            $"Unable to Load FFmpeg Libraries from path:\r\n    {Library.FFmpegDirectory}" +
                            $"\r\nMake sure the above folder contains FFmpeg shared binaries (dll files) for the " +
                            $"applicantion's architecture ({(Environment.Is64BitProcess ? "64-bit" : "32-bit")})" +
                            $"\r\nTIP: You can download builds from https://ffmpeg.zeranoe.com/builds/" +
                            $"\r\n{ex.GetType().Name}: {ex.Message}\r\n\r\nApplication will exit.",
                            "FFmpeg Error",
                            MessageBoxButton.OK,
                            MessageBoxImage.Error);

                        Current?.Shutdown();
                    }));
                }
            });
mariodivece commented 5 years ago

Correct. this is by design.