Difference in AVCapture photo meta data and custom settings which were applied.

I am using below code to apply custom ISO for AVCapture,


do {

if ((try myDevice?.lockForConfiguration()) != nil) {

myDevice?.setExposureModeCustom(duration: AVCaptureDevice.currentExposureDuration, iso: ISOvalue, completionHandler: nil)

myDevice?.unlockForConfiguration()

}

}catch{}



If i apply ISO as 150, and after unlockForConfiguration method, if i print myDevice!.ios then i get value as 50.

And in



func photoOutput(_ captureOutput: AVCapturePhotoOutput, didFinishProcessingPhoto photo:AVCapturePhoto, error: Error?) {

print(photo.metada)

}


when i check this, isoSpeed then this is totaly different value, some what like 25.

This happens for all custom settings like white balance, shutter speed.

Does any one know the reason to this? Why photo metadata shows different settings from applied custom settings.

I have the same problem. I have described it in detail on stackoverflow.com: https://stackoverflow.com/questions/59289876/setexposuremodecustom-duration-iso-values-in-exif-data-do-not-match


TL;DR When locking exposure ISO and duration via setExposureModeCustom and then taking a photo, the exposure ISO and duration in the AVCapturePhoto's metadata (i.e. in the corresponding EXIF Tags) will often be completely different from the values provided to setExposureModeCustom.



> If i apply ISO as 150, and after unlockForConfiguration method, if i print myDevice!.ios then i get value as 50.


I can tell you why, probably. You have to wait for the ISO setting to be applied. That's why setExposureModeCustom allows you to provide a completion handler. The ISO you provide will only be in effect after the completion handler has been called. You don't seem provide a completion handler at all:

myDevice?.setExposureModeCustom(duration: AVCaptureDevice.currentExposureDuration, iso: ISOvalue, completionHandler: nil)


You should add one and put your print statement inside the completion handler. Then the ISO value should be correct.

Hi rnitsch, could you please explain more by example how to achieve this?
Difference in AVCapture photo meta data and custom settings which were applied.
 
 
Q