ivpusic / react-native-image-crop-picker

iOS/Android image picker with support for camera, video, configurable compression, multiple images and cropping
MIT License
6.08k stars 1.55k forks source link

Choosing video files shows processing assets . how to avoid compressing videos ? compressVideo = false not working #950

Open nikhilbiju67 opened 5 years ago

nikhilbiju67 commented 5 years ago

Version

Tell us which versions you are using:

Platform

Tell us to which platform this issue is related

Expected behaviour

Actual behaviour

Steps to reproduce

1.

2.

3.

Attachments

// stacktrace or any other useful debug info

Love react-native-image-crop-picker? Please consider supporting our collective: 👉 https://opencollective.com/react-native-image-crop-picker/donate

kevmmdev commented 5 years ago

Regarding using 'compressVideoPreset' since the documentation is lacking and only stating the default for ios is 'MediumQuality', by default the IOS video compression is too much and I had to do a lot of guessing for the other values of 'compressVideoPreset' because on the documentation there are no other value samples. The value that worked for me was 'HighestQuality' which leaves the video very high quality, it was a guessing game for me. So I guess for the values for compressVideoPreset are 'LowestQuality, 'MediumQuality', 'HighestQuality'. setting it to null crashes the app same with setting it to false.

There is actually no Video compression at the moment on android.

bogdancochioras-clarisoft commented 4 years ago

@electricfeel1979 From the initmethod I see the following presets are set:

    NSMutableDictionary *dic = [[NSMutableDictionary alloc] initWithDictionary:@{
                                                                                 @"640x480": AVAssetExportPreset640x480,
                                                                                 @"960x540": AVAssetExportPreset960x540,
                                                                                 @"1280x720": AVAssetExportPreset1280x720,
                                                                                 @"1920x1080": AVAssetExportPreset1920x1080,
                                                                                 @"LowQuality": AVAssetExportPresetLowQuality,
                                                                                 @"MediumQuality": AVAssetExportPresetMediumQuality,
                                                                                 @"HighestQuality": AVAssetExportPresetHighestQuality,
                                                                                 @"Passthrough": AVAssetExportPresetPassthrough,
                                                                                 }];

    if (@available(iOS 9.0, *)) {
        [dic addEntriesFromDictionary:@{@"3840x2160": AVAssetExportPreset3840x2160}];
    } else {
        // Fallback on earlier versions
    }

    self.exportPresets = dic;

    return self;
}

From what I know Passthrough is available from iOS 11 and it seems 3840x2160 option from iOS 9. From experience I would sugest you use the HighestQuality options which would work on any version and possibly in future iOS versions and it also producess a good result. the only option that you have if you really don't want to use any compression would be Passthrough but, video quality is also specified in the Imagepicker's native properties picker.videoQuality = UIImagePickerControllerQualityTypeHigh; so I don't think you can achieve what you want since Apple doesn't really support any video compression or just started suporting this or not really if you check the Passthrough definition from Apple: AVAssetExportPresetPassthrough

foufrix commented 3 years ago

@bogdancochioras-clarisoft is is possible to have no compression ? I tried with Passthrough and still on big video file (90 minutes) processing asset is way too long.

bvelasquez commented 1 year ago

There's a PR for this. It would be great to get that PR merged.