How to Directly Rotate Cvimagebuffer Image in iOS 4 Without Converting to Uiimage

Rotate CGImage taken from video frame

Depends on whether you are using the front camera or the back camera

int frontCameraImageOrientation = UIImageOrientationLeftMirrored;
int backCameraImageOrientation = UIImageOrientationRight;

UIImage *image = [[UIImage alloc] initWithCGImage:newImage scale:(CGFloat)1.0 orientation:frontCameraImageOrientation];

rotate video with ffmpeg library for iPhone

If you are using AVAssetWriter to write the movie then you can use the transform property on the AVAssetWriterInput. This will write a display transform property into the header of the movie. If you need the frames of the move to literally be rotated then you will need to do the transform before saving each image of the movie. Check out this post for a similar discussion.

The method you use really depends on how you display the video. If you display it using a player such as Quicktime or the iPhone's movie player, then you should use the transform property. If you are processing individual frames of the movie, then you will need to perform the rotation. Rotating the video can be done on the images or on the layer they are displayed on. The only way to get a true movie rotation is to rotate each frame. If this is only for display purposes then I recommend using the transform property, or rotating the layer the movie is displayed on.



Related Topics



Leave a reply



Submit