Wowza Community

Fixing Rotate Video Orientation On IOS


I want to show always one video orientation without device orientation using Gocoder SDK for IOS

for example,

in Gocoder.config

broadcastVideoOrientation = .alwaysPortrait

caputedVideoRotates = false

videoPreviewRotates = false

I did that. then I expected that video orientation never changed althrough device orientation changed, ( portrait -> landscapeLeft).

but as a result, when device orientation changed portrait to landscapeLefe, AVCaptureDataOutput.connections.videoOrientation is changed. so capture video frame was rotated. There is a blank space above and below. The image below shows the video when the device is rotated landscape in portrait broadcasting.

I don’t want to FillMode on this video. just regardless of device rotate, If I choose always portarit or always landscape mode, I want that the video capture orientation is fixed. I wonder caputedVideoRotates would do that the role. but it doesn’t work.

and I tried to rotate ImageBuffer data using WOWZVideoSink::videoFrameWasCaptured(_ imageBuffer: CVImageBuffer)

but It’s not good idea. how I can fix video capture orientation?

i hope result show the desired result regardless of caster device rotate.

Hi @Eugene Jeong, thanks for sharing so much detail and the images are so helpful.

I checked in with the SDK engineers and they say that if you set the capturedVideoRotates to TRUE, but with "always portrait orientation", then it will indeed maintain that portrait orientation, but know that there will be black boxes on the top and bottom and that we cannot change unfortunately.

Here is a chart to show how it works:

thank you for reply.

Sorry but still not solved. so I downloaded several previous sdk versions. and tested.

the property "capturedVideoRotates" worked fine on SDK 1.7.0 as intended,

but other version v1.8.0~v1.9.0 it doesn’t work. so I wonder whether fixing captureVideoRotates was removed. Did your company remove it on purpose?

i just want not to rotate captured video!..but it never do that on latest iOS SDK.

Your SDK samples also show different results according to version.

Please make sure it works properly on IOS SDK.

I’ll have the SDK team take a look when they return from the holiday tomorrow @Eugene Jeong.

Hi @Eugene Jeong

To obtain what you are describing, you have to lock the orientation of your Broadcasting application.

Try selecting Portrait only in the Device Orientation of your General Settings of your app in Xcode.

Let me know.


Hi @Fabio De Lorenzo

Thank you for your reply.

I selected Portrait only in Xcode.

And I set up portarit only in viewcontroller.

override var supportedInterfaceOrientations: UIInterfaceOrientationMask { return .portrait }

override var preferredInterfaceOrientationForPresentation: UIInterfaceOrientation { return .portrait }

override var shouldAutorotate: Bool { return false }

But wowza gocoder preview is still rotated.

Your feedback is very confusing and frustrating.

I look forward to hear from you as soon as possible.