抓取视频的第一帧 - 缩略图分辨率 - iPhone [英] Grabbing First Frame of a Video - Thumbnail Resolution - iPhone

查看:258
本文介绍了抓取视频的第一帧 - 缩略图分辨率 - 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 :

从iPhone SDK中获取视频网址或数据的缩略图

我有两个问题:

1)缩略图的分辨率是多少?我希望以4:3的格式进行预览,并想知道如果放大,图像最终会变得模糊。

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)缩略图的分辨率是否有所不同iPhone / iPad?

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

3)有没有更好的方法来抓取并显示视频的第一帧?

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

谢谢。

推荐答案

以下代码可能对您有所帮助

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;

编辑

以下链接用于如何从视频中获取缩略图

Following link is use for the how to fetch the thumbnail from video

http://www.codza.com/extracting-frames-from-movies-on-iphone

这篇关于抓取视频的第一帧 - 缩略图分辨率 - iPhone的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆