简体   繁体   English

稍后从UIImagePickerController压缩视频吗?

[英]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.

相关问题 从iOS 5中的UIImagePickerController保存视频 - Save video from UIImagePickerController in IOS 5 获取从UIImagePickerController中选择的原始视频名称 - Get original video name as selected from UIImagePickerController 以编程方式从UIImagePickerController保存一段视频 - Save a section of video from UIImagePickerController programmatically 使用OS 3.1中的UIImagePickerController从PhotoLibrary中挑选视频 - Picking video from PhotoLibrary with UIImagePickerController in OS 3.1 使用UIImagePickerController从iPhone复制视频? - copy video from iphone using the UIImagePickerController? uiimagepickercontroller中选择视频文件的应用程序崩溃 - application crash on select video file from uiimagepickercontroller 从UIImagePickerController抓取视频的第一帧? - Grabbing the first frame of a video from UIImagePickerController? 将视频从UIImagePickerController保存到iPhone OS上的Core Data - Saving video from UIImagePickerController to Core Data on iPhone OS 一种在压缩之前从UIImagePickerController检查所选视频文件的方法? - A way to check chosen video file from UIImagePickerController before compression? iPhone:除了使用UIImagePickerController以外,还可以使用其他方式进行视频录制吗? - iPhone: Video recording using any other way apart from UIImagePickerController?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM