2

I want to get Exif information for a video file.

Below is the code to get Exif for image but it doesn't seems to work for videos.

[[PHImageManager defaultManager] requestImageDataForAsset:photoAsset
                                              options:reqOptions
                                        resultHandler:
     ^(NSData *imageData, NSString *dataUTI, UIImageOrientation orientation, NSDictionary *info) {
         CIImage* ciImage = [CIImage imageWithData:imageData];
         DLog(@"Metadata : %@", ciImage.properties);
     }];

Is there any way to get the exif without writing the file into disk ?

Ekra
  • 3,241
  • 10
  • 41
  • 61

2 Answers2

0

Please check for the documentation.

You can get the information for the video:

 - (PHImageRequestID)requestPlayerItemForVideo:(PHAsset *)asset 
                                  options:(PHVideoRequestOptions *)options 
                            resultHandler:(void (^)(AVPlayerItem *playerItem, NSDictionary *info))resultHandler;

Try using Utility for metadata: https://github.com/zakkhoyt/PHAsset-Utility

Hope it helps. :)

0

To get metadata for video file use below API where the information is in AVAsset object.

    - (PHImageRequestID)requestAVAssetForVideo:(PHAsset *)asset options:(nullable PHVideoRequestOptions *)options 
                resultHandler:(void (^)(AVAsset *__nullable asset, AVAudioMix *__nullable audioMix, NSDictionary *__nullable info))resultHandler;
Ekra
  • 3,241
  • 10
  • 41
  • 61