Closed Manischi closed 2 weeks ago
I tested your project and had to make some changes to get it to work. In your App.xaml.cs, you need to change to the following:
using System.Windows;
using Unosquare.FFME;
namespace testwpf
{
public partial class App : Application
{
public App()
{
Unosquare.FFME.Library.FFmpegDirectory = @"C:\Users\HouseOfGrace\source\repos\testwpf\testwpf\ffmpeg";
}
protected override void OnStartup(StartupEventArgs e)
{
Task.Run(async () =>
{
try
{
// Pre-load FFmpeg
await Library.LoadFFmpegAsync();
}
catch (Exception ex)
{
var dispatcher = Current?.Dispatcher;
if (dispatcher != null)
{
await 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.org/download.html" +
$"\r\n{ex.GetType().Name}: {ex.Message}\r\n\r\nApplication will exit.",
"FFmpeg Error",
MessageBoxButton.OK,
MessageBoxImage.Error);
Current?.Shutdown();
}));
}
}
});
}
}
}
The try-catch code will let you know if you're using the wrong FFMPEG version, which leads me to the next issue. Since you're using the 4.4.350 Nuget package, you also need to use the 4.4 library files. However, FFMPEG 4.4 is so outdated that hardly any place seems to have the library files for download. I'd recommend going to 7.0 version since that's what Unosquare is currently supporting and working on. This is the 4.4 library I found that worked for me with the above fixes: https://sourceforge.net/projects/avbuild/files/windows-desktop/ffmpeg-4.4-windows-desktop-vs2022-gpl-lite.7z/download
Thank you for quick answer. I thought me should wait a mounth or smth :)
OMG. It`s working.
I thought 4.4.350 lib version is the newest version. Installing 7.0.361-beta.1 helped run the files.
Problem was in different FFME and ffmpeg version libraries.
Thank you again
Can`t open no one file
I installed ffmpeg, added to PATH, to my projects folder and spec link in 'App Code-Behind.' FFME also.
Issue Categories
Version Information
MainWindow XAML
Code-Behind
App Code-Behind
Project copy
https://github.com/Manischi/testwpf
Result
Nothing. Tried different syntax. If use try-catch no mistakes called.