How to get BGR from Unity Texture GetPixel?

Unity ReadPixel only support RGBA.
Agora only support BGRA externalVideoFrame when pushing to server.

You can change the format to BGRA in Unity:

But i’m not using for AR…
I would like to share screen…

Texture2D mTexture = new Texture2D((int)mRect.width, (int)mRect.height, TextureFormat.RGBA32, false);
mTexture.ReadPixels(mRect, 0, 0);
//Apply the Pixels read from the rectangle to the texture
yield return new WaitForEndOfFrame();
// Get the Raw Texture data from the the from the texture and apply it to an array of bytes
bytesSrc = mTexture.GetRawTextureData();
// Make enough space for the bytes array
int size = Marshal.SizeOf(bytesSrc[0]) * bytesSrc.Length;
//Create a new external video frame
ExternalVideoFrame externalVideoFrame = new ExternalVideoFrame();
//Set the buffer type of the video frame
externalVideoFrame.type = ExternalVideoFrame.VIDEO_BUFFER_TYPE.VIDEO_BUFFER_RAW_DATA;
// Set the video pixel format
externalVideoFrame.format = ExternalVideoFrame.VIDEO_PIXEL_FORMAT.VIDEO_PIXEL_BGRA;
//apply raw data you are pulling from the rectangle you created earlier to the video frame
externalVideoFrame.buffer = bytesSrc;
//Set the width of the video frame (in pixels)
externalVideoFrame.stride = (int)mRect.width;
//Set the height of the video frame
externalVideoFrame.height = (int)mRect.height;
//Remove pixels from the sides of the frame
externalVideoFrame.cropLeft = 0;
externalVideoFrame.cropTop = 0;
externalVideoFrame.cropRight = 0;
externalVideoFrame.cropBottom = 0;
//Rotate the video frame (0, 90, 180, or 270)
externalVideoFrame.rotation = 180;
// increment i with the video timestamp
externalVideoFrame.timestamp = i++;
//Push the external video frame with the frame we just created
int a = rtc.PushVideoFrame(externalVideoFrame);
//Debug.Log(" pushVideoFrame = " + a);

try to change like : TextureFormat.BGRA32

if I change to this:

Texture2D mTexture = new Texture2D((int)mRect.width, (int)mRect.height, TextureFormat.BGRA32, false);
mTexture.ReadPixels(mRect, 0, 0);

at this ReadPixels, Unity will give error said only support RGB, RGBA.

what‘s your Unity version