【发布时间】:2013-02-18 07:40:16
【问题描述】:
我正在使用下面的代码来压缩视频。
- (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:AVAssetExportPresetMediumQuality];
exportSession.outputURL = outputURL;
exportSession.outputFileType = AVFileTypeQuickTimeMovie;
[exportSession exportAsynchronouslyWithCompletionHandler:^(void)
{
if (exportSession.status == AVAssetExportSessionStatusCompleted)
{
printf("completed\n");
NSLog(@"outputurl is %@",outputURL);
}
else
{
printf("error\n");
NSLog(@"error is %@",exportSession.error);
}
}];
}
压缩后视频在 iOS6 中声音非常低,但在 iOS 5 中我得到了完整的原始音量,那么如何在 iOS 6 中获得原始音量。
【问题讨论】:
标签: iphone objective-c ios6 mpmovieplayercontroller avfoundation