title: Unity3d convert Texture2d into bitmap format
body: <p>I had made an attempt to get this done but unfortunately I am coming up short not sure what I am doing wrong. </p>
  
  <pre><code>private void CreateMovie(List&lt;Texture2D&gt; textures, string fileName, int frameRate)
  {
      var writer = new AviWriter(fileName + ".avi")
      {
          FramesPerSecond = frameRate,
          EmitIndex1 = true
      };
  
      var stream = writer.AddVideoStream();
      stream.Width = _images[0].width;
      stream.Height = _images[0].height;
      stream.Codec = KnownFourCCs.Codecs.Uncompressed;
      stream.BitsPerPixel = BitsPerPixel.Bpp32;
  
      int count = 0;
  
      while (count &lt; textures.Count)
      {
          byte[] byteArray = textures[count].GetRawTextureData();
          stream.WriteFrame(false, byteArray, 0, byteArray.Length);
          count++;
      }
  
      writer.Close();
  }
  </code></pre>
  
  <p>Once I write the bytes to file and try to open it I get the file is in a unknown format.</p>