1
votes

I am using AVAssetReader and AVAssetWriter to transcode video from one file to another. AVAssetReaderTrackOutput was added to the AVAssetReader. Unfortunately, the single track's preferredTransform property was not copied from the input to the output, so a video recorded in portrait orientation is played back in landscape.

How can I set the preferredTransform property in the output file?

1
Steve seemed to have an answer at stackoverflow.com/questions/3823461/… but didn't say what it was...user258279

1 Answers

6
votes

I've just found my own answer: Set the transform property of the AVAssetWriterInput to the preferredTransform property of the input track, for example:-

assetWriterInput.transform = [[tracks objectAtIndex:0] preferredTransform];

Would have found this quicker in the doco if these two properties hadn't had different names for the same thing.