Getting video snapshot for thumbnail Getting video snapshot for thumbnail xcode xcode

Getting video snapshot for thumbnail


To fix the thumbnail orientation set appliesPreferredTrackTransform to YES in the AVAssetImageGenerator instance. If you add your own video composition, you'll need to include the right transform to rotate the video as wanted.

generate.appliesPreferredTrackTransform = YES;

Remember to release the obtained image reference with CGImageRelease.

To request multiple thumbnails it's better to do asynchronously with generateCGImagesAsynchronouslyForTimes:completionHandler:.