I am using an AVAssetWriter to encode a series of images to a movie file, following Zoul\'s answer here: How do I export UIImage array as a movie?.
In short my proc
Ok, this turned out to be an issue with the aspect ratio of the images I was reading in being different from the aspect ratio of the PixelBuffer I was creating. Made them equal and it works fine.
Old thread but different answer, instead of multiplying by a number I use CVPixelBufferGetBytesPerRow to get the actual bytes per row for CGBitmapContextCreate and it fixed the distortion, leaving height/width the same
Please take a look at this link. It says the width should be a multiple of 16.
Just get the size.width, calculate the nearest number which is multiple of 16. And hard code it in place of size.width.
It works :)