I am using UIImagePickerController to select video from Gallery and it compress that video.I want to disable Compression but I don't find the way to do this. I also tried with ELCImagePickerController it is showing video but it is looking like an image only there is no video icon or time duration like it shows in UIImagePickercontroller.How can I do it?
Thanks.
With iOS 11 you can set the property
videoExportPreset
toAVAssetExportPresetPassthrough
to get the original:The "Video compression..." label just flashes for a few milliseconds and then the export is done.
@Diego Renau almost had the correct answer.
It doesn't look like it's possible to avoid compression using the UIImagePickerController. See this answer:
https://stackoverflow.com/a/5893066/406152
I've tried using
imagePicker.videoQuality = UIImagePickerControllerQualityTypeHigh;
but it still does compression. Ugh.EDIT:
However, you can roll your own. This will allow access to the raw video files:
iOS 8
Look at the PhotoKit documentation for accessing collections (moments) and other options.
Here is a sample app from Apple using PhotoKit that could be modified to be a photo picker: https://developer.apple.com/library/ios/samplecode/UsingPhotosFramework/Introduction/Intro.html
Here is a photo picker library on GitHub that uses PhotoKit that looks promising since it gives you the
PHAsset
objects for all the selected images/videos: https://github.com/guillermomuntaner/GMImagePickeriOS 7 and below
Actually, you can get the original video URL, non-compressed version, via the following code:
As a reminder, the requestAVAssetForVideo call is asynchronous, so be careful when you want to store the url with a blocked variable outside the method calling block.
With iOS 11 you can use the property "videoExportPreset". It's not the original but at least I can get more than 1280x720...