Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

The color of video is wrong when made from UIImage of the PNG files

Tags:

iphone

video

I am taking a UIImage from Png file and feed it to the videoWriter.

avAdaptor appendPixelBuffer:pixelBuffer

When the end result video comes out, it seems to lacking the one color, missing the yellow color or something.

I take alook of the function that made the pixelbuffer out of the UIImage

CVPixelBufferCreateWithBytes(NULL,
                             myWidth,
                             myHeight,
                             kCVPixelFormatType_32BGRA, 
                             (void*)CFDataGetBytePtr(image), 
                             CGImageGetBytesPerRow(cgImage), 
                             NULL, 
                             0,
                             NULL, 
                             &pixelBuffer);

I also try the kCVPixelFormatType_32AGRB and others, it didn't help.

any thoughts?

like image 775
lilzz Avatar asked Oct 25 '10 06:10

lilzz


1 Answers

Please verify if your PNG image is with or without transparency element. If your PNG image doesn't contain transparency then it's 24-bit and not 32-bit per pixel.

Also, have you tried kCVPixelFormatType_32RGBA ?

like image 76
Usman.3D Avatar answered Sep 23 '22 09:09

Usman.3D