I used below code to convert an mov file to mp4 in my mac os x app:

- (IBAction)convertAction:(id)sender {

    NSString *sampleMov = [@"~/Desktop/sample_mov.mov"
stringByExpandingTildeInPath];

    AVURLAsset *avAsset = [AVURLAsset URLAssetWithURL:[NSURL
fileURLWithPath:sampleMov]
options:nil];

  //  NSArray *compatiblePresets = [AVAssetExportSession
exportPresetsCompatibleWithAsset:avAsset];

    AVAssetExportSession *exportSession = [[AVAssetExportSession alloc]
initWithAsset:avAsset presetName:AVAssetExportPresetPassthrough];

    NSString *videoPath = [@"~/Desktop/sample_mp4_movie.mp4"
stringByExpandingTildeInPath];

    exportSession.outputURL = [NSURL fileURLWithPath:videoPath];

    NSLog(@"videopath of your mp4 file = %@",videoPath);  // PATH OF YOUR
.mp4 FILE

    exportSession.outputFileType = AVFileTypeMPEG4;

     [exportSession exportAsynchronouslyWithCompletionHandler:^{

        switch ([exportSession status]) {

             case AVAssetExportSessionStatusFailed:

                NSLog(@"Export failed: %@", [[exportSession error]
localizedDescription]);

              break;

              case AVAssetExportSessionStatusCancelled:

                NSLog(@"Export canceled");

               break;

          default: break;

        }    }];

}
Though it has successfully converted the file, the same file when sent to
an android device could not be played :(

Any ideas?

-- 
Thanks,

Devarshi
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to