tomaszzmuda / Xabe.FFmpeg

.NET Standard wrapper for FFmpeg. It allows to process media without know how FFmpeg works, and can be used to pass customized arguments to FFmpeg from dotnet core application.

Home Page:https://xabe.net/product/xabe_ffmpeg/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

The specified executable is not a valid application for this OS platform.

wsamplaw opened this issue · comments

I am getting a System.ComponentModel.Win32Exception (0x80004005): The specified executable is not a valid application for this OS platform exception doing a FFmpeg.Conversions.FromSnippet.Split only when the FFmpeg.SetExecutablesPath is set to a different path then where I extracted the FFmpeg files from the .zip file.
I added ffmpeg.exe and ffprobe.exe to my project folder, added the files to my project and have them set to Copy always. I am trying to use them from the assembly location (the files are in the assembly location).

This is the entire exception:
System.ComponentModel.Win32Exception (0x80004005): The specified executable is not a valid application for this OS platform.
at System.Diagnostics.Process.StartWithCreateProcess(ProcessStartInfo startInfo)
at System.Diagnostics.Process.Start()
at Xabe.FFmpeg.FFmpeg.RunProcess(String args, String processPath, Nullable1 priority, Boolean standardInput, Boolean standardOutput, Boolean standardError) at Xabe.FFmpeg.FFmpegWrapper.<>c__DisplayClass14_0.<RunProcess>b__0() at System.Threading.Tasks.Task1.InnerInvoke()
at System.Threading.Tasks.Task.Execute()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Xabe.FFmpeg.Conversion.d__35.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()

This is how I am setting the executable path when the exception happens:
FFmpeg.SetExecutablesPath(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location));

I added a line in my log to get FFmpeg's executable path _logger.DebugFormat("FFmpeg exe path {0}", FFmpeg.ExecutablesPath);
And that displays what appears to be a valid path
FFmpeg exe path C:\Development<solution name>\bin\x86\Debug

Should I be using more FFmpeg files in my project?

My project is a WinForms app using .NET Framework 4.8 and Xabe.FFmpeg 5.2.6.

Thanks