[英]Compress video from UIImagePickerController at a later time?
I was wondering if anyone has suggestions on how to compress a video that is recorded/selected with a UIImagePickerController, at a later time. 我想知道是否有人在以后建议如何压缩使用UIImagePickerController录制/选择的视频。
Scenario: 场景:
User picks or records a video at Medium quality. 用户选择或录制中等质量的视频。 I later upload this video to my server. 稍后,我将此视频上传到服务器。 However, I would like to check at the time of uploading whether the user is on 3G or Wifi, and transcode/compress to a lower quality at that time if needed. 但是,我想在上传时检查用户是否使用3G或Wifi,并在需要时将代码转码/压缩为较低的质量。
I understand that I could specify the quality when I display the picker, but it would provide more flexibility if I could grab the clip in a higher quality format, and then only compress later if needed. 我知道可以在显示选择器时指定质量,但是如果可以以更高质量的格式抓取剪辑,然后仅在需要时进行压缩,它将提供更大的灵活性。
I haven't been able to find any way to do this in the Apple docs, and have also been unable to find any 3rd party libs for video compression. 我无法在Apple文档中找到任何实现此目的的方法,也无法找到用于视频压缩的任何第三方库。 Does anyone have any suggestions? 有没有人有什么建议?
Thanks! 谢谢!
Apple don't provide any sort of libraries for transcoding videos - but I'm surprised you haven't been able to find and 3rd party libraries. Apple没有提供用于视频转码的任何类型的库-但令您惊讶的是,您还没有找到第三方库。 FFMPEG is the library of choice. FFMPEG是首选的库。 Now, it is in C, but it's perfectly usable and workable on iOS. 现在,它是用C语言编写的,但是在iOS上是完全可用和可操作的。 Note that there are some LGPL things you have to be aware of when using FFMPEG. 请注意,使用FFMPEG时需要注意一些LGPL事项。
Note that transcoding is an expensive process, especially in terms of CPU usage, so this may not actually be the best option. 请注意,代码转换是一个昂贵的过程,尤其是在CPU使用率方面,因此这实际上并不是最佳选择。 Better to let iOS handle it for you where at all possible. 最好让iOS尽可能地为您处理它。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.