Hi @BradLarson ,
I'm having trouble understanding how GPUImageMovie/GPUImageView orientation works.
I modify the SimpleVideoFileFilter example to load video using UIImagePickerController so I can test various kind of videos.
And no matter witch video I loaded (portrait, landscape, upsideDown) the result was always a landscape orientation video.
below is my code
This Code For Camera Orientation
[func checkOrientationForVideo(assets:AVAsset){
let orientation = assets.video_orientation
if (orientation == .landscapeLeft){
kVCOrientation = .Landscap
let value = UIInterfaceOrientation.landscapeLeft.rawValue
UIDevice.current.setValue(value, forKey: "orientation")
}
else if (orientation == .landscapeRight){
kVCOrientation = .LandscapRight
let value = UIInterfaceOrientation.landscapeRight.rawValue
UIDevice.current.setValue(value, forKey: "orientation")
}
else if (orientation == .portraitUpsideDown || orientation == .portrait){
kVCOrientation = .Protrait
let value = UIInterfaceOrientation.portrait.rawValue
UIDevice.current.setValue(value, forKey: "orientation")
}
switch kVCOrientation {
case .Landscap:
self.videoCamera?.outputImageOrientation = .landscapeLeft
break;
case .LandscapRight:
self.videoCamera?.outputImageOrientation = .landscapeRight;
break;
case .Protrait:
self.videoCamera?.outputImageOrientation = .landscapeLeft;
break;
case .All:
self.videoCamera?.outputImageOrientation = .portrait;
break;
}
UIViewController.attemptRotationToDeviceOrientation()
}]
and the second one is for FilterView
if SelectedMedia.sharedInstance.selectedMedia.isImage == false {
self.checkOrientationForVideo(assets: SelectedMedia.sharedInstance.selectedMedia.videoAssets)
switch kVCOrientation {
case .Landscap:
self.filterView?.setInputRotation(.noRotation, at: 0)
case .LandscapRight:
self.filterView?.setInputRotation(.noRotation, at: 0)
case .Protrait:
self.filterView?.setInputRotation(.noRotation, at: 0)
case .All:
self.filterView?.setInputRotation(.noRotation, at: 0)
}
Same codes are work fine for Image Filter but getting issue in video filter.
I wasted my 3 day :( hope any one come ahead and give proper solution for this. Thanks You
Hi @BradLarson , I'm having trouble understanding how GPUImageMovie/GPUImageView orientation works. I modify the SimpleVideoFileFilter example to load video using UIImagePickerController so I can test various kind of videos. And no matter witch video I loaded (portrait, landscape, upsideDown) the result was always a landscape orientation video.
below is my code This Code For Camera Orientation [func checkOrientationForVideo(assets:AVAsset){ let orientation = assets.video_orientation if (orientation == .landscapeLeft){ kVCOrientation = .Landscap let value = UIInterfaceOrientation.landscapeLeft.rawValue UIDevice.current.setValue(value, forKey: "orientation") } else if (orientation == .landscapeRight){ kVCOrientation = .LandscapRight let value = UIInterfaceOrientation.landscapeRight.rawValue UIDevice.current.setValue(value, forKey: "orientation") } else if (orientation == .portraitUpsideDown || orientation == .portrait){ kVCOrientation = .Protrait let value = UIInterfaceOrientation.portrait.rawValue UIDevice.current.setValue(value, forKey: "orientation") } switch kVCOrientation { case .Landscap: self.videoCamera?.outputImageOrientation = .landscapeLeft break; case .LandscapRight: self.videoCamera?.outputImageOrientation = .landscapeRight; break; case .Protrait: self.videoCamera?.outputImageOrientation = .landscapeLeft; break; case .All: self.videoCamera?.outputImageOrientation = .portrait; break; } UIViewController.attemptRotationToDeviceOrientation() }]
and the second one is for FilterView
if SelectedMedia.sharedInstance.selectedMedia.isImage == false { self.checkOrientationForVideo(assets: SelectedMedia.sharedInstance.selectedMedia.videoAssets)
switch kVCOrientation { case .Landscap: self.filterView?.setInputRotation(.noRotation, at: 0) case .LandscapRight: self.filterView?.setInputRotation(.noRotation, at: 0) case .Protrait: self.filterView?.setInputRotation(.noRotation, at: 0) case .All: self.filterView?.setInputRotation(.noRotation, at: 0) }
Same codes are work fine for Image Filter but getting issue in video filter.
I wasted my 3 day :( hope any one come ahead and give proper solution for this. Thanks You