AVAssetExportSession increasing the size of video instead of compressing

584 views Asked by At
- (void)convertVideoToLowQuailtyWithInputURL:(NSURL*)inputURL outputURL:(NSURL*)outputURL handler:(void (^)(AVAssetExportSession*))handler
{
    [[NSFileManager defaultManager] removeItemAtURL:outputURL error:nil];
    AVURLAsset *asset = [AVURLAsset URLAssetWithURL:inputURL options:nil];
    exportSession = [[AVAssetExportSession alloc] initWithAsset:asset presetName:AVAssetExportPresetMediumQuality];
    exportSession.outputURL = outputURL;
    exportSession.outputFileType = AVFileTypeMPEG4;
    exportSession.fileLengthLimit = 20*1024*1024;
    [exportSession exportAsynchronouslyWithCompletionHandler:^(void)
     {
         handler(exportSession);
     }];
}

I am using this code to compress a video

  1. With the above code I successfully compressed 106mb video to 25mb.

  2. With the above code I tried to compress 285mb video and I get 1.59gb as an output.

I can't understand what is going wrong.

0

There are 0 answers