How does GPUImageFilter setInputRotation: atIndex: method work?

1 reply [Last post]
slevi
User offline. Last seen 8 years 48 weeks ago. Offline
Joined: 04/20/2012
Posts:

Hi guys.

I have an app which uses the GPUImage framework. I want to achieve the following: record a landscape video, when the device is held in landscape orientation, while the outputImageOrientation is set to portrait. I saw a question about this and Brad suggested to use the setInputRotation method of a filter. I tried to use it but without success, so my question is how should I use this method to achieve what I want. I tried the method with the SimpleVideoFilter example application and I didn't saw any rotation with the following code:

videoCamera = [[GPUImageVideoCamera alloc] initWithSessionPreset:AVCaptureSessionPreset640x480 cameraPosition:AVCaptureDevicePositionBack];
videoCamera.outputImageOrientation = UIInterfaceOrientationPortrait;
filter = [[GPUImageSepiaFilter alloc] init];

[videoCamera addTarget:filter];
[filter setInputRotation:kGPUImageRotateLeft atIndex:0];

GPUImageView *filterView = (GPUImageView *)self.view;
[filter addTarget:filterView];

[videoCamera startCameraCapture];

Please provide some example code or point out where am I doing something wrong.

Thank you

Brad Larson
Brad Larson's picture
User offline. Last seen 4 years 22 weeks ago. Offline
Joined: 05/14/2008
Posts:

In the above code, you don't want to set the rotation. That will be set properly for you when you specify the output orientation of the video coming from the camera.

You don't show how you're going to be recording the video, so I'll assume that you will add the movie writer as an output of your filter. In that case, you could add the movie writer and set the rotation on that to counter the portrait orientation.

Syndicate content