Wednesday 7 March 2012

Read the asset from the Library and get decompres

In the above post the size of the asset file is too big so here is another way to decompress the file
This is also taken from the stack over flow,

http://stackoverflow.com/questions/5687341/iphoneprogrammatically-compressing-recorded-video-to-share



- (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
     {
         handler(exportSession);
         [exportSession release];
     }];
}

No comments:

Post a Comment