获取iOSvideo的时间戳/位置
我可以使用Image Picker获取.MOV文件,但是如何才能find拍摄地点和拍摄时间?
我的图像select器: – (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info {
NSString *mediaType = [info objectForKey: UIImagePickerControllerMediaType]; [self dismissViewControllerAnimated:NO completion:nil]; // Handle a movie capture if (CFStringCompare ((__bridge_retained CFStringRef)mediaType, kUTTypeMovie, 0) == kCFCompareEqualTo) { NSString *movieFile = [[info objectForKey: UIImagePickerControllerMediaURL] path]; NSURL *movieURL = [NSURL fileURLWithPath:movieFile]; NSLog(@"Movie File %@",movieURL); [self dismissViewControllerAnimated:YES completion:nil]; } }
我不知道它的位置,但您可以使用File Attribute Keys
来获取NSFileCreationDate
使用attributesOfItemAtPath:error:
。 在NSDictionary
fileCreationDate
上有一个方便的方法
NSError *error; NSDictionary *attributes = [[NSFileManager defaultManager] attributesOfItemAtPath:movieFile error:&error]; if (!attributes) { // Use the error } NSDate *createdDate = [attributes fileCreationDate];
如果你想访问MOV文件的元数据,你可以看看EXIF数据,但是我不知道是否有一个iOS库。