是否可以获取远程(但如果需要的话我可以先下载)GIF 序列并在设备上制作 MPMovies PlayerViewController 可播放的 mp4?
我尝试过使用http://api.online-convert.com/ http://api.online-convert.com/,但是 API 不适合,而且免费版本对于我们的需求来说太有限了。
iOS 版 Imagemagick https://www.imagemagick.org/script/download.php#iOS似乎也不包括 GIF 支持。
斯威夫特 3.0 版本。
https://gist.github.com/powhu/00acd9d34fa8d61d2ddf5652f19cafcf https://gist.github.com/powhu/00acd9d34fa8d61d2ddf5652f19cafcf
Usage
let data = try! Data(contentsOf: Bundle.main.url(forResource: "gif", withExtension: "gif")!)
let tempUrl = URL(fileURLWithPath:NSTemporaryDirectory()).appendingPathComponent("temp.mp4")
GIF2MP4(data: data)?.convertAndExport(to: tempUrl, completion: { })
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)