Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to extract stream of images from video file using ffmpeg
    text
    copied!<p>I want to extract stream of images from a video file using ffmpeg.</p> <p>I know I can extract them straight to the hard drive using these arguments:</p> <p>-i - -qscale 1 h:\out\img-%05d.jpg</p> <p>But i would like to extract directly to a stream.</p> <p>This is my code so far:</p> <pre><code>private void ExtractImagesFromVideo(byte[] data,string _args) { try { serverBuild = new Process(); serverBuild.StartInfo.WorkingDirectory = Environment.CurrentDirectory; serverBuild.StartInfo.Arguments = _args; serverBuild.StartInfo.FileName = Environment.CurrentDirectory + @"\ffmpeg.exe"; serverBuild.StartInfo.UseShellExecute = false; serverBuild.StartInfo.RedirectStandardOutput = true; serverBuild.StartInfo.RedirectStandardError = true; serverBuild.StartInfo.RedirectStandardInput = true; serverBuild.StartInfo.CreateNoWindow = true; serverBuild.StartInfo.LoadUserProfile = false; serverBuild.EnableRaisingEvents = true; serverBuild.Start(); using (BinaryWriter bw = new BinaryWriter(serverBuild.StandardInput.BaseStream)) { bw.Write(data); } mStandardOutput = serverBuild.StandardOutput.BaseStream; mStandardOutput.BeginRead(mReadBuffer, 0, mReadBuffer.Length, StandardOutputReadCallback, null); serverBuild.WaitForExit(); byte[] _data = mStandardOutputMs.ToArray(); mStandardOutput.Close(); } catch (Exception _ex) { } finally { serverBuild.Dispose(); } } </code></pre> <p>and I call like like this:</p> <pre><code> string _argsOut = @"-i pipe:0 -qscale 1 -f mjpeg pipe:1 "; ExtractImagesFromVideo(data, _argsOut); </code></pre> <p>and it hangs on this line:</p> <pre><code>bw.Write(data); </code></pre> <p>thanks</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload