ios 从相册视频中获取视频截图
2024-08-30 09:47:54
//给image添加个分类
+(UIImage *)getImage:(NSURL: *)videoURL
{
AVURLAsset *asset = [[AVURLAsset alloc] initWithURL:[NSURL fileURLWithPath:videoURL] options:nil];
AVAssetImageGenerator *gen = [[AVAssetImageGenerator alloc] initWithAsset:asset];
gen.appliesPreferredTrackTransform = YES;
CMTime time = CMTimeMakeWithSeconds(0.0, 600);
NSError *error = nil;
CMTime actualTime;
CGImageRef image = [gen copyCGImageAtTime:time actualTime:&actualTime error:&error];
UIImage *thumb = [[UIImage alloc] initWithCGImage:image];
CGImageRelease(image);
return thumb;
}
最新文章
- html基础起航
- .Net 中的反射(序章) - Part.1
- 数据库imp导表dmp的方法
- tcp选项TCP_DEFER_ACCEPT
- luogu[1140]相似基因
- September 24th 2016 Week 39th Saturday
- PHP抓取网络数据的6种常见方法
- bzoj 1500: [NOI2005]维修数列 splay
- 阿里巴巴开源项目:分布式数据库同步系统otter(解决中美异地机房) - agapple - ITeye技术网站
- Jsensation | 氪加
- Perception(1.2)
- iOS网络编程笔记——XML文档解析
- 《SpringMVC从入门到放肆》五、SpringMVC配置式开发(处理器适配器)
- springMVC下载中文文件名乱码【原】
- 使用chttpfile的一个错误
- Confluence 6 通过 SSL 或 HTTPS 运行 - 修改你 Confluence 的 server.xml 文件
- Linq的执行效率及优化
- InfluxDB1.2.4部署(centos6.8)
- 关于Tomcat配置虚拟路径保存、访问图片
- 解决C3P0在Linux下Failed to get local InetAddress for VMID问题