0

I have a movie file, what I'm trying to do is show the first screen of this movie in a UIImage on my screen. The user selects the UIImage/button, and it plays the movie. The issue I'm having is how do i get this initial screenshot.

Best example i can use to demonstrate is using iPhone/iPad, make a video, go to library and you can see a thumbnail showing the initial screen of the video. How can i achieve this.

thanks

Gabriele Petronella
  • 106,943
  • 21
  • 217
  • 235

1 Answers1

0

To get a framegrab:

   

    AVAssetImageGenerator* generator = [AVAssetImageGenerator assetImageGeneratorWithAsset:destinationAsset];

    //Get the 1st frame 3 seconds in
    int frameTimeStart = 3;
    int frameLocation = 1;

    //Snatch a frame
    CGImageRef frameRef = [generator copyCGImageAtTime:CMTimeMake(frameTime,frameLocation)

    AVAssetImageGenerator* generator = [AVAssetImageGenerator assetImageGeneratorWithAsset:destinationAsset];

    //Get the 1st frame 3 seconds in
    int frameTimeStart = 3;
    int frameLocation = 1;

    //Snatch a frame
    CGImageRef frameRef = [generator copyCGImageAtTime:CMTimeMake(frameTime,frameLocation)