iPhone视频压缩开/关

时间:2010-08-17 10:33:43

标签: iphone objective-c cocoa-touch video-capture

我通过以下方式实现了视频捕获:

IImagePickerController *imagePicker = [[UIImagePickerController alloc] init];    
imagePicker.sourceType =  UIImagePickerControllerSourceTypeCamera;  
NSArray *sourceTypes = [UIImagePickerController availableMediaTypesForSourceType:imagePicker.sourceType];
if ([sourceTypes containsObject:(NSString *)kUTTypeMovie ]){
    imagePicker.mediaTypes =  sourceTypes;
}           
imagePicker.delegate = self;
[self presentModalViewController:imagePicker animated:YES];
[imagePicker release];

我可以使用YouTube API录制视频并将其发送到YouTube,但如果视频长度超过5分钟,我点击USE - 应用程序将关闭。但是如果我从图书馆选择10分钟的视频(我看到“压缩视频”进度),视频就会保存到我的视图并上传到YouTube,就不会出现问题。

有人可以告诉我问题是什么吗?

1 个答案:

答案 0 :(得分:1)

您使用了高分辨率1280x720的QualityTypeHigh。所以它需要很多记忆。

UIImagePickerController *imagePicker = [[UIImagePickerController alloc] init];
imagePicker.delegate = self;

[imagePicker setVideoQuality:UIImagePickerControllerQualityQualityTypeMedium];

imagePicker.sourceType = UIImagePickerControllerSourceTypeCamera;

imagePicker.mediaTypes = [NSArray arrayWithObject:(NSString *)kUTTypeMovie];

[imagePicker setVideoMaximumDuration:30];

imagePicker.allowsEditing = YES;

[self presentModalViewController:imagePicker animated:YES];

[imagePicker release];