We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hi, I'm using FFMediaToolKit in a Unity 3D project to create videos of Unity's 3D scene. I'm capturing Unity's camera view as follows:
_screenShot = new Texture2D(Screen.width, Screen.height, TextureFormat.RGB24, false); _captureCamera.targetTexture = _renderTexture; RenderTexture.active = _renderTexture; _screenShot.ReadPixels(new Rect(0,0,Screen.width, Screen.height),0,0); _screenShot.Apply(); var pixelData = _screenShot.GetRawTextureData();
The above code provides a byte array of raw pixel data. When I take the byte array and try to construct an 'ImageData' object
ImageData.FromArray(pixelData , ImagePixelFormat.Rgb24, Screen.width, Screen.height);
I get the following exception:
Pixel buffer size doesn't match size required by this image format.
You use the following formula to calculate the expected stride:
4 * (((GetBitsPerPixel(format) * width) + 31) / 32);
However the byte array generated by Unity is
Screen.Width x Screen.height x 3
3 bytes per pixel corresponding to the 'TextureFormat.RGB24'
Is there any course of action I can take to resolve this difference?
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Hi,
I'm using FFMediaToolKit in a Unity 3D project to create videos of Unity's 3D scene. I'm capturing Unity's camera view as follows:
The above code provides a byte array of raw pixel data. When I take the byte array and try to construct an 'ImageData' object
I get the following exception:
You use the following formula to calculate the expected stride:
However the byte array generated by Unity is
3 bytes per pixel corresponding to the 'TextureFormat.RGB24'
Is there any course of action I can take to resolve this difference?
The text was updated successfully, but these errors were encountered: