ios - GPUImageMovie not respecting imageOrientation -
I'm using GPUImageMovie which is playing a movie file, this file was filed on the iOS device.
However, when GPUImageMovie plays it, it is in the wrong orientation so that the video can not be displayed correctly.
How do I get it in honor of my orientation? I have tried to modify the open code with no luck.
I had the same problem when playing a video record using the GPUImageMovie in the IOS device, I did it the following functions Resolved using:
Set this code by calling this filter: RotationFor Filter: . orientationForTrack:
will return your current video orientation
- (zero) setRotationForFilter: (GPUImageOutput & LT; GPUImageInput & gt; *) filterRef {UIInterfaceOrientation Orientation = [Self OrientationForTrack :. Self .playerItem.asset]; If (Orientation == UIInterfaceOrientationPortrait) {[filterRef set input rotation: kGPUImageRotateRight atIndex: 0]; } Else if (Orientation == UIInterfaceOrientationLandscapeRight) {[filterRef setInputRotation: kGPUImageRotate180 atIndex: 0]; } Else if (Orientation == UIInterfaceOrientationPortraitUpsideDown) {[filterRef setInputRotation: kGPUImageRotateLeft atIndex: 0]; }} - (UIInterfaceOrientation) orientationForTrack: (AVAsset *) property {AVAssetTrack * videoTrack = [[Property tracksWithMediaType: AVMediaTypeVideo] objectAtIndex: 0]; CGSize size = [VideoTrack naturalSize]; CGAffineTransform txf = [videotrack favorite transform]; If (size.method == TxFTX & SizeHigh == TxFT) returns urinterface orientation londascape right; Else if (txf.tx == 0 & amp; amp; txf.ty == 0) return UIInterfaceOrientationLandscapeLeft; And if (txf.tx == 0 & amp; amp; txf.ty == size.width) return UIInterfaceOrientationPortraitUpsideDown; And return UIInterfaceOrientationPortrait; }
Hope this fixes your problem.
Comments
Post a Comment