1
AVCaptureVideoDataOutput
에서 얻은 동영상을 AVAsset
으로 저장하려면 아래의 writeVideoAtPathToSavedPhotosAlbum
을 사용하십시오.사진 앨범에 저장 한 비디오의 정보를 URL로 가져옵니다.
NSString* filename = [NSString stringWithFormat:@"capture%d.mp4", _currentFile];
NSString* path = [NSTemporaryDirectory() stringByAppendingPathComponent:filename];
NSURL* url = [NSURL fileURLWithPath:path];
dispatch_async(dispatch_get_main_queue(), ^{
[_encoder finishWithCompletionHandler:^{
ALAssetsLibrary *library = [[ALAssetsLibrary alloc] init];
[library writeVideoAtPathToSavedPhotosAlbum:url completionBlock:^(NSURL *assetURL, NSError *error){
NSLog(@"save completed");
}];
}];
});
그러나 비디오를 저장 한 후 나는 우리가 UIImagePickerController
을 사용하는 경우 다음과 같이 얻을 다시처럼 '동영상 정보 저장'을 싶어.
- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info {
[picker dismissViewControllerAnimated:YES completion:NULL];
NSLog(@"there");
// Handle a movie capture
NSString *type = info[UIImagePickerControllerMediaType];
NSURL *videoURL = info[UIImagePickerControllerMediaURL];
//do things with that info
}