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

System.InvalidOperationException: Cannot start process because a file name has not been provided.

waleswood opened this issue · comments

System.InvalidOperationException: Cannot start process because a file name has not been provided.
   at System.Diagnostics.Process.Start()
   at Xabe.FFmpeg.FFmpeg.RunProcess(String args, String processPath, Nullable`1 priority, Boolean standardInput, Boolean standardOutput, Boolean standardError)
   at Xabe.FFmpeg.FFprobeWrapper.<>c__DisplayClass9_0.<RunProcess>b__0()
   at System.Threading.Tasks.Task`1.InnerInvoke()
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
--- End of stack trace from previous location ---
   at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread)
--- End of stack trace from previous location ---
   at Xabe.FFmpeg.FFprobeWrapper.RunProcess(String args, CancellationToken cancellationToken)
   at Xabe.FFmpeg.FFprobeWrapper.GetFormat(String videoPath, CancellationToken cancellationToken)
   at Xabe.FFmpeg.FFprobeWrapper.SetProperties(MediaInfo mediaInfo, CancellationToken cancellationToken)
   at Xabe.FFmpeg.MediaInfo.Get(String filePath, CancellationToken cancellationToken)
   at Xabe.FFmpeg.MediaInfo.Get(String filePath)
   at Xabe.FFmpeg.FFmpeg.GetMediaInfo(String fileName)
   at Xabe.FFmpeg.Conversion.Split(String inputPath, String outputPath, TimeSpan startTime, TimeSpan duration)
   at Xabe.FFmpeg.Snippets.Split(String inputPath, String outputPath, TimeSpan startTime, TimeSpan duration)

Hi,

Can you provide arguments passed to ffmpeg (they are inside ConversionResult object)?

I have encountered a similar problem using 5.1.0.
It occurs with high probability when FFmpeg.GetMediaInfo(path) is called from multiple threads in parallel.
The path settings in ffmpeg and ffprobe are defaults.

If ffmpeg,ffprobe does not exist in the same folder as the executable file, the path to ffmpeg,ffprobe will be null at the following timing, which seems to occur when ffmpeg,ffprobe is called from another thread while looking for it from the environment variable.
https://github.com/tomaszzmuda/Xabe.FFmpeg/blob/master/src/Xabe.FFmpeg/FFmpeg.cs#L62

as @Freeesia said, The way I use the lock temporarily solve the problem, but can't support concurrent