lunadiviner
lunadiviner

Reputation: 509

Issues with video recording being upside down and AVMutableComposition rotating video

I've got a strange problem going on with video recording and putting said video into a composition. If the device is oriented landscape left (button on the left), the video records upside down and then when it's put into the composition it's rotated 180 degrees so that it appears right side up. If the device is oriented landscape right, the video is recorded right side up but then is rotated in the composition so that it's upside down. I'm not really sure what would cause this or how to fix it; I could force the app to only run in landscape left so that the final product looks just fine but this feels sloppy and I'd prefer a better solution. The device in question is the newest iPad, I'm not sure if it behaves this way on other devices as well.

Upvotes: 2

Views: 1836

Answers (1)

Davyd Geyl
Davyd Geyl

Reputation: 4623

When a movie is recorded on the iPad or iPhone, the actual video data is never rotated, but information about orientation is stored with the movie. Orientation data can be accessed via [AVAsset preferredTransform] property. Alternatively you can get it from the video track (AVAssetTrack). In order to play this kind of movie correctly set the preferredTransform property of the corresponding composition track.

Upvotes: 3

Related Questions