取视频的第一帧作为初始页面
来源:互联网 发布:人工智能 视频分析 编辑:程序博客网 时间:2024/06/05 11:02
NSString *url = [Utils applicationCachesDirectory:self.videourl];
url = [Utils applicationDocumentsDirectory:self.videourl];
NSURL *videoURL = [NSURL fileURLWithPath:url];
NSDictionary *opts = [NSDictionary dictionaryWithObject:[NSNumber numberWithBool:NO]
forKey:AVURLAssetPreferPreciseDurationAndTimingKey];
AVURLAsset *urlAsset = [AVURLAsset URLAssetWithURL:videoURL options:opts];
//NSLog(@"视频的路径是:%@", videoURL);
AVAssetImageGenerator *generator = [AVAssetImageGenerator assetImageGeneratorWithAsset:urlAsset];
generator.appliesPreferredTrackTransform = YES;
generator.maximumSize = CGSizeMake(360.0f, 480.0f);
NSError *error = nil;
/*** Returns a CGImage for the asset at or near a specified time. */
/*** - (CGImageRef)copyCGImageAtTime:(CMTime)requestedTime actualTime:(CMTime *)actualTime error:(NSError **)outError */
CGImageRef cgImg = [generator copyCGImageAtTime: CMTimeMake(1, 1) actualTime:NULL error:&error];
url = [Utils applicationDocumentsDirectory:self.videourl];
NSURL *videoURL = [NSURL fileURLWithPath:url];
NSDictionary *opts = [NSDictionary dictionaryWithObject:[NSNumber numberWithBool:NO]
forKey:AVURLAssetPreferPreciseDurationAndTimingKey];
AVURLAsset *urlAsset = [AVURLAsset URLAssetWithURL:videoURL options:opts];
//NSLog(@"视频的路径是:%@", videoURL);
AVAssetImageGenerator *generator = [AVAssetImageGenerator assetImageGeneratorWithAsset:urlAsset];
generator.appliesPreferredTrackTransform = YES;
generator.maximumSize = CGSizeMake(360.0f, 480.0f);
NSError *error = nil;
/*** Returns a CGImage for the asset at or near a specified time. */
/*** - (CGImageRef)copyCGImageAtTime:(CMTime)requestedTime actualTime:(CMTime *)actualTime error:(NSError **)outError */
CGImageRef cgImg = [generator copyCGImageAtTime: CMTimeMake(1, 1) actualTime:NULL error:&error];
0 0
- 取视频的第一帧作为初始页面
- 取视频的第一帧作为初始页面
- 取视频的第一帧作为初始页面
- 在iOS开发中,在视频初始状态时获取视频的第一帧图片
- H5上传视频,截取视频第一帧作为视频封面,遇到的坑
- canvas动态获取视频第一帧 作为介绍
- 获取视频的第一帧
- ASP.NET截取上传视频,swf文件第一帧作为预览图片
- android第一课,初始环境的搭建
- 获取录制的视频的第一帧
- 如何截取视频的第一帧
- ASP.NET页面初始的过程
- appfuse初始页面加载慢的问题
- idea修改tomcat启动的初始页面
- ImageView显示视频的第一帧图片&&VideoView视频播放
- scrapy初始第一波——爬取伯乐在线所有文章
- 视频第一帧
- 获取视频第一帧
- struts2 中的ActionContext与ServletActionContext
- Java与C通讯 网络流解析
- C++ explicit关键字
- 黑马程序员_Java基础[16]_多态2
- DateTime类型ToString时要显示AM/PM怎么办
- 取视频的第一帧作为初始页面
- 设计模式之单例模式(Singleton)
- armv6, armv7, armv7s的区别
- 南阳理工OJ_题目44 子串和
- HDOJ1856 More is better 【并查集】
- [POJ1062] 昂贵的聘礼 枚举等级 + dijkstra
- Bootstrap3.0入门学习系列(二)视频学习篇
- 适配器创建Spinner列表框
- java-Collections对象的降序排序--实例