我使用UIImagePicker录制视频,当我点击录制按钮时我想用声音捕捉帧并将其添加到一个阵列中。请帮我提前完成同样的感谢。
答案 0 :(得分: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.
}
}