title: System.InvalidOperationException thrown when running as part of a WPF application. Xabe.FFmpeg
body: <p>I have the following code which runs on a console application</p>
  <pre class="lang-cs prettyprint-override"><code>  string filePath = &quot;C:\\Users\\**\\Desktop\\sample-mp4-file.mp4&quot;;
    string output1 = &quot;C:\\Users\\**\\Desktop\\1.jpg&quot;;
    string output2 = &quot;C:\\Users\\**\\Desktop\\2.jpg&quot;;
    var ms = new MultiSnapshotCommand(filePath);
    await ms.Add(TimeSpan.FromSeconds(20), output1);
    await ms.Add(TimeSpan.FromSeconds(20), output2);
    await ms.Invoke();
  </code></pre>
  <p>Which uses the following</p>
  <pre class="lang-cs prettyprint-override"><code>  public async Task Add(TimeSpan timestamp, string outputPath)
    {
        var conversion = await FFmpeg.Conversions.FromSnippet.Snapshot(filePath, outputPath, timestamp);
        conversionQueue.Enqueue(conversion);
    }
  </code></pre>
  <p>This executes fine and both snapshots are created when calling <code>Invoke()</code>.
  However, when executing the same code running in an async method in response to a button click in a WPF scenario, the UI freezes, then a few moments later <code>Exception thrown: 'System.InvalidOperationException' in System.Diagnostics.Process.dll</code> is shown from the debugger output with no recovery.</p>
  <p>The error seems to be occurring at <code>await FFmpeg.Conversions.FromSnippet.Snapshot(filePath, outputPath, timestamp);</code></p>
  <p>Original - <a href="https://github.com/tomaszzmuda/Xabe.FFmpeg/issues/341" rel="nofollow noreferrer">https://github.com/tomaszzmuda/Xabe.FFmpeg/issues/341</a></p>
  <h2>Edit</h2>
  <p>My project files <a href="https://github.com/Scharps/MP4ToImageConverter/tree/05beeb1cc359b654fb51a9695b5c20386c4d5fb6" rel="nofollow noreferrer">https://github.com/Scharps/MP4ToImageConverter/tree/05beeb1cc359b654fb51a9695b5c20386c4d5fb6</a>.
  FFmpeg is required in Path system variable. File locations will need to be changed also</p>