Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #import <AssetsLibrary/AssetsLibrary.h>
- #import <AVFoundation/AVFoundation.h>
- // temp filename
- NSString *fname = [NSString stringWithFormat:@"%.f.mp4", [NSDate timeIntervalSinceReferenceDate]];
- NSURL *videoURL = [NSURL fileURLWithPath:[NSTemporaryDirectory() stringByAppendingPathComponent:fname]];
- // convert to MP4
- AVURLAsset *asset = [AVURLAsset URLAssetWithURL:url options:nil];
- AVAssetExportSession *session = [AVAssetExportSession exportSessionWithAsset:asset presetName:AVAssetExportPresetPassthrough];
- session.outputFileType = AVFileTypeMPEG4;
- session.outputURL = videoURL;
- [session exportAsynchronouslyWithCompletionHandler:^{
- NSLog("Video converted!");
- }];
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement