Pixel formats, CVPixelBufferRefs and glReadPixels
问题 I'm using glReadPixels to read data into a CVPixelBufferRef . I use the CVPixelBufferRef as the input into an AVAssetWriter . Unfortunately the pixel formats seem to be mismatched. I think glReadPixels is returning pixel data in RGBA format while AVAssetWriter wants pixel data in ARGB format. What's the best way to convert RGBA to ARGB ? Here's what I've tried so far: bit manipulation along the lines of argb = (rgba >> 8) | (rgba << 24) using a CGImageRef as an intermediate step The bit