Grabbing First Frame of a Video - Thumbnail Resolution - iPhone

丶灬走出姿态 提交于 2019-12-07 02:09:12

问题


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.


回答1:


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;


来源:https://stackoverflow.com/questions/10209012/grabbing-first-frame-of-a-video-thumbnail-resolution-iphone

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!