title: Piping FFmpeg output to Unity texture
body: <p>I'm working on a networking component where the <strong>server</strong> provides a Texture and sends it to FFmpeg to be encoded (h264_qsv), and sends it over the network. The <strong>client</strong> receives the stream (mp4 presumably), decodes it using FFmpeg again and displays it on a Texture. </p>
  
  <p>Currently this works very slowly since I am saving the texture to the disk before encoding it to a mp4 file (also saved to disk), and on the client side I am saving the .png texture to disk after decoding it so that I could use it in Unity.</p>
  
  <p>Server side FFmpeg process is started with <code>process.StartInfo.Arguments = @" -y -i testimg.png -c:v h264_qsv -q 5 -look_ahead 0 -preset:v faster -crf 0 test.qsv.mp4";</code> currently and client side with <code>process.StartInfo.Arguments = @" -y -i test.qsv.mp4 output.png";</code></p>
  
  <p>Since this needs to be <strong>very fast</strong> (30 fps at least) and real time, I need to <strong>pipe the Texture directly</strong> to the FFmpeg process. On the client side, I need to <strong>pipe the decoded data to the displayed Texture</strong> directly as well (opposed to saving it and then reading from disk).</p>
  
  <p>A few days of researching showed me that FFmpeg supports various pipelining options, including using data formats such as <em>bmp_pipe</em> (piped bmp sequence), <em>bin</em>(binary text), <em>data</em> (raw data) and <em>image2pipe</em> (piped image2 sequence) however documentation and examples on how to use these options are very scarce. </p>
  
  <p>Please help me: which format should I use (and how should it be used) ?</p>