当我单击录制按钮时,我正在使用 UIImagePicker 录制视频,我想用声音捕获帧并将其添加到一个数组中。请帮助我提前完成同样的工作。
问问题
271 次
1 回答
0
尝试使用此示例代码在帧中录制视频
编辑
- (void)video:(NSString*)videoPath didFinishSavingWithError:(NSError*)error contextInfo:(void*)contextInfo {
NSLog(@"%@",contextInfo);
if (error) {
}else{
NSURL *videoURl = [NSURL fileURLWithPath:videoPath];
AVURLAsset *asset = [[AVURLAsset alloc] initWithURL:videoURl options:nil];
AVAssetImageGenerator *generate = [[AVAssetImageGenerator alloc] initWithAsset:asset];
generate.appliesPreferredTrackTransform = YES;
NSError *err = NULL;
CMTime time = CMTimeMake(1, 60);// heare you can set more then one image time
CGImageRef imgRef = [generate copyCGImageAtTime:time actualTime:NULL error:&err];
self.strUploadVideoURL = videoPath;
self.strOriginalVideoURL = videoPath;
UIImage *img = [[UIImage alloc] initWithCGImage:imgRef];
// use this image to add in array.
}
}
于 2013-05-16T11:28:07.703 回答