I am getting inputurl [info objectForKey:UIImagePickerControllerMediaURL] from UIImagepickercontroller's didFinishPickingMediaWithInfo's method. 
NSURL *inputURL = [NSURL URLWithString:inputurlstring];
I am giving outputurl from this code
        NSString  *documentsDirectory = [paths objectAtIndex:0];
        NSString *videoPath = [NSString stringWithFormat:@"%@/%@", documentsDirectory,@"capturedvideo.MOV"];
        NSURL *outputURL = [NSURL fileURLWithPath:videoPath];
I used the following code to get low quality video
 - (void)convertVideoToLowQuailtyWithInputURL:(NSURL*)inputURL 
    outputURL:(NSURL*)outputURL 
    handler:(void (^)(AVAssetExportSession*))handler 
    { 
    [[NSFileManager defaultManager] removeItemAtURL:outputURL error:nil]; 
    AVURLAsset *asset = [AVURLAsset URLAssetWithURL:inputURL options:nil]; 
    AVAssetExportSession *exportSession = [[AVAssetExportSession alloc] initWithAsset:asset presetName:AVAssetExportPresetLowQuality]; 
    exportSession.outputURL = outputURL; 
    exportSession.outputFileType = AVFileTypeQuickTimeMovie; 
    [exportSession exportAsynchronouslyWithCompletionHandler:^(void) 
    { 
    if (exportSession.status == AVAssetExportSessionStatusCompleted) 
    { 
    printf("completed\n"); 
    } 
    else 
    { 
    printf("error\n"); 
    NSLog(@"error is %@",exportSession.error); 
    } 
    }]; 
}           
I am getting following error when I use large files only. Because when I use small size video file I did not get any error.
Error Domain=NSURLErrorDomain Code=-1 "unknown error" UserInfo=0x616d890         
 {NSErrorFailingURLStringKey=/private/var/mobile/Applications/EE1E6701-EED0-4830-BD1D-7366680713C0/tmp//trim.7mL7VS.MOV, NSErrorFailingURLKey=/private/var/mobile/Applications/EE1E6701-EED0-4830-BD1D-7366680713C0/tmp//trim.7mL7VS.MOV, NSLocalizedDescription=unknown error, NSUnderlyingError=0x2d1460 "The operation couldn’t be completed. (OSStatus error -12935.)", NSURL=/private/var/mobile/Applications/EE1E6701-EED0-4830-BD1D-7366680713C0/tmp//trim.7mL7VS.MOV}
                the above code is perfectly works. the only change is inputURL.
after I changed the inputURL to fileURLWithPath:
 NSURL *inputURL = [NSURL fileURLWithPath:inputurlstring];
Now its perfectly works.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With