Search code examples
iphoneuiimagepickercontroller

How to avoid compression after selecting video from UIImagePickerController in ios


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.


Solution

  • With iOS 11 you can set the property videoExportPreset to AVAssetExportPresetPassthrough to get the original:

    if #available(iOS 11.0, *) {
        picker.videoExportPreset = AVAssetExportPresetPassthrough
    }
    

    The "Video compression..." label just flashes for a few milliseconds and then the export is done.

    @Diego Renau almost had the correct answer.