Aquisition metadata on video files from Sony cameras - ISO, aperture, shutter...

Started by kamilkp, February 24, 2021, 12:16:18 PM

Previous topic - Next topic

kamilkp

Hello,
I'm trying to use exiftool to read metadata from video files such as shutter speed, ISO, aperture etc. It works great on footage from Canon cameras for example but not on footage from Sony mirrorless cameras.

I have a clip from my Sony a7s II and when I import it into Catalyst Browse I see the aquisition metadata section with the following entries (screenshot attached).

If I run just exiftool file.mp4 I only get things like resolution, frame rate, codec, etc. but nothing about exposure settings. When I however run exiftool -u -ee file.mp4 I get a bunch of additional data including entries like these:

Quote
Date Time                       : 2021:02:22 10:16:02
Sample Time                     : 0:00:55
Sample Duration                 : 0.04 s
Sony rtmd 0x060e                : 6 14 43 52 2 83 1 1 12 2 1 1 1 1 0 0
Sony rtmd 0x8000                : 40960
Sony rtmd 0x060e                : 6 14 43 52 2 83 1 1 12 2 1 1 2 1 0 0
Sony rtmd 0x8100                : 6 14 43 52 4 1 1 11 5 16 1 1 1 1 0 0
Sony rtmd 0x8101                : 0
Sony rtmd 0x8109                : 1 50
Sony rtmd 0x810a                : 1800
Sony rtmd 0x810b                : 1600
Sony rtmd 0x810c                : 100
Sony rtmd 0x810d                : 0
Sony rtmd 0x3210                : 6 14 43 52 4 1 1 6 14 6 4 1 1 1 3 4
Sony rtmd 0x060e                : 6 14 43 52 2 83 1 1 12 2 1 1 127 1 0 0
Sony rtmd 0xe000                : 150 105 8 0 70 120 3 28 32 81 0 0 240 192 17 129
Sony rtmd 0xe300                : 0
Sony rtmd 0xe301                : 1600
Sony rtmd 0xe302                : 1
Sony rtmd 0xe303                : 4

Sony rtmd 0x810b with the value of 1600 would match the ISO, Sony rtmd 0x8109 with the value of "1 50" would match the shutter speed: 1/50s but I cannot find a way to decipher the aperture or as Catalyst Browse says "Iris f-number" out of that data.

Any hints or tips how to achieve that would be much appreciated!

Phil Harvey

Thanks!  I'll add support for these.

Maybe try taking a few sample videos at various aperture settings to see what changes in the unknown rtmd tags.  Also, you might try changing ISO because 0xe301 also has a value of 1600 in your example.

Anything else you can discover would be very useful.  There are a lot of settings stored in this information that are not currently known.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

kamilkp

Yeah the value of ISO seems to exist in both 0xe301 and 0x810b no matter what ISO do I use.

When it comes to aperture I tried hard and couldn't figure it out but I think it might be either 0x810d or 0xe300. I sometimes saw different values there depending on the aperture and sometimes those would be values unknown in unicode (like ? sign characters). However there are often just 0 in those fields now that I checked on some more clips.

QuoteI'll add support for these.

That would be awesome! When could one expect such a thing to be added? In a matter of weeks/months?

Phil Harvey

Quote from: kamilkp on February 24, 2021, 05:00:47 PM
When could one expect such a thing to be added? In a matter of weeks/months?

Actually a matter of minutes... I'm preparing a release now.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

Phil Harvey

Quote from: Phil Harvey on February 24, 2021, 08:36:44 PM
Actually a matter of minutes... I'm preparing a release now.

OK, that took longer than it should have.  Grrrrrr.  Somehow my recent MacOS security update broke CVS in Cygwin of my Windows virtual machine, and I had to find a work-around.  (Yes, I do my Windows development in Cygwin on a Windows virtual machine running on a Mac.)

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

kamilkp

Thanks Phil, I just installed the 12.21 and I see ISO and shutter speed indeed!

What about the aperture thing though? Is this info in one of those two places I pointed to just in a weird format hard to display in plain text?

I can send you some sample few seconds long clips if you want.

kamilkp

Update:

Just did some tests to figure out if we could read the White Balance setting from the metadata and here's what I found:


Shot with incadecent WB:


Sony rtmd 0xe303                : 1

Shot with cloudy WB:


Sony rtmd 0xe303                : 5

Short with shade WB:


Sony rtmd 0xe303                : 6

Shot with daylight WB:


Sony rtmd 0xe303                : 4


---
Also I tried different apertures again and I found a pattern:

f/1.4

Sony rtmd 0x8000                : 61559


f/1.6

Sony rtmd 0x8000                : 59981


f/1.8

Sony rtmd 0x8000                : 58589


f/2

Sony rtmd 0x8000                : 57344


f/2.2

Sony rtmd 0x8000                : 56218


f/2.5

Sony rtmd 0x8000                : 54707


f/2.8

Sony rtmd 0x8000                : 53367


f/3.2

Sony rtmd 0x8000                : 51789


f/3.5

Sony rtmd 0x8000                : 50730


f/4

Sony rtmd 0x8000                : 49152


f/4.5

Sony rtmd 0x8000                : 47760


f/5

Sony rtmd 0x8000                : 46515


f/5.6

Sony rtmd 0x8000                : 45175


f/6.3

Sony rtmd 0x8000                : 43783


f/7.1

Sony rtmd 0x8000                : 42371


f/8

Sony rtmd 0x8000                : 40960


f/9

Sony rtmd 0x8000                : 39568


f/10

Sony rtmd 0x8000                : 38323


f/11

Sony rtmd 0x8000                : 37196


f/13

Sony rtmd 0x8000                : 35222


f/14

Sony rtmd 0x8000                : 34346


f/16

Sony rtmd 0x8000                : 32768



And from what I see the same values appear regardless of the camera/lens combination used.

Phil Harvey

This is very good.  Thanks!  I should be able to decode the FNumber with this information.

I'll also add the WhiteBalance, but there are some missing numbers.  The numbers you have discovered so far don't correspond to any WhiteBalance settings in the MakerNotes for any Sony camera, so I can't guess at the missing ones.  So far you have done Incandescent, Cloudy, Shade, and Daylight.  If there are other WhiteBalance settings, maybe you could try them too.

Also, I'm guessing that if there is an Auto ISO setting, one or the other of the ISO values may change during the video if the lighting changes sufficiently.  My thought is that maybe one is an ISO setting, and the other is ISO actually used.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

kamilkp

On my a7s II these are the only 4 WB presets. The other options are custom WB and I wonder how that would be encoded in the metadata - I will try and let you know.

QuoteAlso, I'm guessing that if there is an Auto ISO setting, one or the other of the ISO values may change during the video if the lighting changes sufficiently.  My thought is that maybe one is an ISO setting, and the other is ISO actually used.

From what I see calling
exiftool -ee
on a piece of Sony footage

returns a ton of info grouped in a way that correspond to portions of the video.

So my guess is that if ISO changes during the recording it will just change between one portion and the other.


Date Time                       : 2021:01:11 09:35:22
Sample Time                     : 3.72 s
Sample Duration                 : 0.04 s
Sony rtmd 0x060e                : 6 14 43 52 2 83 1 1 12 2 1 1 1 1 0 0
Sony rtmd 0x8000                : 32768
.
.
.
Date Time                       : 2021:01:11 09:35:22
Sample Time                     : 3.76 s
Sample Duration                 : 0.04 s
Sony rtmd 0x060e                : 6 14 43 52 2 83 1 1 12 2 1 1 1 1 0 0
Sony rtmd 0x8000                : 32768
.
.
.



Sample duration of 0.4 second would be just a single frame at 24fps. So I think we have frame by frame metadata embedded in those files.

Please let me know once you figure out the math to parse the F Numbers!

Thanks!

Phil Harvey

Quote from: kamilkp on February 25, 2021, 07:21:15 AM
So my guess is that if ISO changes during the recording it will just change between one portion and the other.

Yes, but will both 0x810b and 0xe301 change?

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

Phil Harvey

I figured out the FNumber:  FNumber =  2 ** (8 -$val/8192)

I'll add this in version 12.22.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

kamilkp

Quote from: Phil Harvey on February 25, 2021, 07:45:22 AM
Quote from: kamilkp on February 25, 2021, 07:21:15 AM
So my guess is that if ISO changes during the recording it will just change between one portion and the other.

Yes, but will both 0x810b and 0xe301 change?

- Phil

I'll test! And I'll also test custom white balances.

Phil Harvey

Based on your initial post, I think I can guess at CameraMasterGainAdjustment (0x810a / 100), and ElectricalExtenderMagnification (0x810c).  I'll add these too.  If you can change any of the other settings that are shown in the "Acquisition Metadata" window, we can probably figure out those too.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

kamilkp

0x810a is Camera master gain adjustment indeed


and yes 0x810c matches ElectricalExtenderMagnification  :)

kamilkp

White Balance update:


0xe303

4 - Sunny
6 - Shade
5 - Cloudy
1 - Incadescent
2 - Fluorescent (all four types that are options on the a7s II)
6 - Custom
255 - Preset


By "Custom" I mean the mode where you input the value in Kelvin by hand. And the value itself doesn't seem to be preserved anywhere - it doesn't show up in Catalyst Browse either.

By "Preset" I mean the mode where you take a photo of a graycard and it figures out the "current" temperature and you can save up to 3 of those presets. In this mode 0x810d has the value of 1 whereas in any other modes it has the value of 0.

As you can see Custom is indistinguishable from Shade - I couldn't find any difference between them. In both of these modes Catalyst Browse says "Lighting preset: Other".

And also the value of 3 seem to be missing from 0xe303 - I couldn't get it to be 3 in any of the WB modes.

Phil Harvey

Great, thanks!  I'll add these.  I guess 6 should be "Custom" then (it seems that Shade may be implemented as a Custom setting).

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).


mithr4ndr

kamil, im also dumbfounded with the aqcuisition metadata. did you find focal length in there somewhere?

awonglk

Is there any chance exiftool can "write" Sony Aquisition metadata into existing video files?
This is especially useful for those using adapted manual lenses, thus missing FNumber field in the recorded video files.
Populating FNumber will enable Catalyst to use the gyro data to stabilise video files recorded with a manual lens.


Phil Harvey

If the FNumber exists in the file, but is zero, there is a remote possibility that I could eventually add the ability to write this (as long as it isn't in the timed metadata, which I fear it may be because I think that "rtmd" = "Real Time MetaData").  But if it doesn't exist, you're out of luck because I don't plan to add the ability to create proprietary metadata in video files (video metadata in general is a big mess, and proprietary metadata is next level, so the pain-to-gain ratio for doing this would be much too high).

I think the simplest way around this would be if Catalyst could add the ability to input an FNumber for manual lenses.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

awonglk

As you suspected, FNumber is missing from the timed metadata.
It's also missing Aperture value, although this does not look like it's part of the time series.

All good. I've reached out to Catalyst team. Hopefully they can address this.

Philbec44

Hi,
I am using exiftool to write A7M3 MP4 Metadata in a CSV file for DaVinci Resolve. I noticed that ISO value is a rtmd value recorded every 40ms (1/25FPS). So, I get hundreds times ISO value in the CSV file. Is there an option to write only once ISO value in the CSV file ?
Thank you for your help
have a good day
Philbec44

StarGeek

I faintly recall a similar question, maybe the same, some time ago.  But because ISO and GPS are extremely common words here, it's going to be difficult to find.
* Did you read FAQ #3 and use the command listed there?
* Please use the Code button for exiftool code/output.
 
* Please include your OS, Exiftool version, and type of file you're processing (MP4, JPG, etc).

Phil Harvey

If you use the -csv option you will only get one ISO value.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

Philbec44

Hi Phil,
First of all, thank you for this tool which is a great help and thanks for responding
I use -csv option but unfortunatly, it doesn't work. It is certainly because I use -ee option to get information I am expecting. To get some specific metadata, I use join_tags config file you wrote.
In out.csv, you will see that I get many ISO value and "SourceFile" tag at the end.
I tried outputting in txt format with -w! option. It was the same for ISO but "SourceFile" tag dissapeared.
Have a good day
Philbec44

exiftool_Sony.bat
join_tags.config
out.csv
Sony_7M3_1.fmt   

Phil Harvey

You are not using the -csv option.  You are using -p.  These options are mutually exclusive, and the -p overrides the -csv.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

Philbec44

I was using -p option with an fmt file to "translate" Sony tags to DaVinci Resolve tags.
When I remove -p option, it works but is there a way to rename Sony tags to DaVinci tags ?

Phil Harvey

The only way I can think of doing this is by creating simple user-defined Composite tags which are based on the other tags bug have the names that you want.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).