I had made an attempt to get this done but unfortunately I am coming up short not sure what I am doing wrong.
private void CreateMovie(List<Texture2D> 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 < textures.Count)
{
byte[] byteArray = textures[count].GetRawTextureData();
stream.WriteFrame(false, byteArray, 0, byteArray.Length);
count++;
}
writer.Close();
}
Once I write the bytes to file and try to open it I get the file is in a unknown format.
Can you post your code for writing to the texture?
To convert your Texture to a different format, you will need to create a new Texture with the desired format, then write the data to the texture.
Use the following constructor: public Texture2D(int width, int height, TextureFormat textureFormat = TextureFormat.RGBA32, bool mipChain = true, bool linear = false);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.