I am using UIImagePickerController
to capture video in iPhone but video is showing rotated 90 digree to right.
How to fix this issue
Is there any way by which we can correct the orientation.
I am using UIImagePickerController
to capture video in iPhone but video is showing rotated 90 digree to right.
How to fix this issue
Is there any way by which we can correct the orientation.
you need make the re-encode video using AVExportSession to rotate video to correct orientation like said Oleksiy Ivanov. So you need something like this:
just need change self.videoUrl for you video url and it should work fine :)
[EDIT] Edited to add description how video re-encoding can be done on device.
When video is recorded with UIImagePickerController it should have orientation embedded in video file as exif flag. Video itself is in portrait orientation. When such video is played on iPhone (or in other way where exif rotation is honoured) the video should be oriented correctly. For example way to play a video explained http://mobile.tutsplus.com/tutorials/iphone/mediaplayer-framework_mpmovieplayercontroller_ios4/ .
If video is played in a custom way then orientation should be extracted from video (for example as described here https://stackoverflow.com/a/9195350/2546685) and applied during playback.
It is also possible to re-encode video using AVExportSession to rotate video to correct orientation and avoid using exif flag during playback. Example how re-encoding can be done: Combining this answer https://stackoverflow.com/a/16314552/2546685 with this one https://stackoverflow.com/a/9195350/2546685 (I did not tried to compile, syntax errors may exists) ->