Reputation:
We're trying to take an existing video with audio (.mov) and make a more email friendly version. Seems pretty straightforward and the code below does just what we need ... almost.
On an iPad2 (4.3.3) it works in debug & release builds all of the time. On the iPhone 4 (4.3.3) or 4th gen iPod Touch there's no audio. From time to time, no obvious correlation as to what triggers it, it will start working on the iPhone. Delete the app, rebuild/install, and it no longer works.
AVURLAsset* asset = [AVURLAsset URLAssetWithURL:[NSURL fileURLWithPath:sourcePath] options:nil];
session = [[AVAssetExportSession alloc] initWithAsset:asset
presetName:AVAssetExportPresetLowQuality];
session.outputURL = [NSURL fileURLWithPath:destPath];
session.outputFileType = AVFileTypeQuickTimeMovie;
session.shouldOptimizeForNetworkUse = YES;
[session exportAsynchronouslyWithCompletionHandler:^{
[self performSelectorOnMainThread:@selector(conversionFinished)
withObject:nil
waitUntilDone:NO]; }];
Upvotes: 2
Views: 1483
Reputation: 18343
Are you playing the movie too, for example in an MPMoviePlayer? I have had some occasional export quirks while playing or using other initialized assets with the same URLs.
Upvotes: 1