Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Grabbing First Frame of a Video - Thumbnail Resolution - iPhone

I want to display the (static) first frame of a video in my app as a preview.

I have read through this thread and understand that I could use a thumbnail :

Getting a thumbnail from a video url or data in iPhone SDK

I have two questions :

1) What is the resolution of the thumbnail ? I am looking to make the preview a 4:3 format and wonder if the image will end up looking blurry if enlarged.

2) Does the resolution of the thumbnail differ for iPhone / iPad ?

3) Is there a better way to grab and display the first frame of a video ?

Thank you.

like image 557
GuybrushThreepwood Avatar asked Apr 18 '12 12:04

GuybrushThreepwood


1 Answers

Following code may helping to you

NSString *str = [[self.vedioArray objectAtIndex:i] valueForKey:@"vName"];
    NSURL *videoURL = [NSURL URLWithString:str] ;
    MPMoviePlayerController *player = [[[MPMoviePlayerController alloc] initWithContentURL:videoURL]autorelease];
  UIImage  *thumbnail = [player thumbnailImageAtTime:1.0 timeOption:MPMovieTimeOptionNearestKeyFrame];
    player = nil;
like image 176
Nimit Parekh Avatar answered Sep 22 '22 16:09

Nimit Parekh