In file renamer Sub Second in ## format

Started by ThomasAdams, June 26, 2013, 07:04:57 AM

Previous topic - Next topic

ThomasAdams

I have been trying, but am unable to obtain seb second from Exif data with 2 digits.

I have tried the following variables:

{File.MD.Exif::Main\37520\SubSecTime\0}
{File.MD.Exif::Main\37521\SubSecTimeOriginal\0}
{File.MD.Exif::Main\37522\SubSecTimeDigitized\0}
1/100 Second in SS Format

Any helpful tips?

I have a naming converntion that is YYYY-MM-DD_HHMMSSss (ss is subsecond).EXT
For instance: 2011-06-10_13374208

Mario

It would be helpful to know what results you get?
Empty?
Number format wrong?

When you view the metadata for one of your files in the Metadata Panel (switch to the Browser layout to see all metadata contained in the file), are the sub second metadata tags filled?

Tip: To try out variables and variable formatting functions, you can use the Var Toy App: Make sure the App Panel is visible and then select this App from the drop-down list in the App Panel.
-- Mario
IMatch Developer
Forum Administrator
http://www.photools.com  -  Contact & Support - Follow me on 𝕏 - Like photools.com on Facebook

sinus

Quote from: ThomasAdams on June 26, 2013, 07:04:57 AM
I have been trying, but am unable to obtain seb second from Exif data with 2 digits.

I have tried the following variables:

{File.MD.Exif::Main\37520\SubSecTime\0}
{File.MD.Exif::Main\37521\SubSecTimeOriginal\0}
{File.MD.Exif::Main\37522\SubSecTimeDigitized\0}
1/100 Second in SS Format

Any helpful tips?

I have a naming converntion that is YYYY-MM-DD_HHMMSSss (ss is subsecond).EXT
For instance: 2011-06-10_13374208

Hm, hi Thomas
I tried in the renamer your variable

{File.MD.Exif::Main\37522\SubSecTimeDigitized\0}

and the filename changed to 80.nef

what is correct, because the 80 is the subsec of sec

Here the whole date/time of this file: 2013:06:11 10:23:27.80

Did I understand something wrong?
Best wishes from Switzerland! :-)
Markus

ThomasAdams

#3
Quote from: Mario on June 26, 2013, 08:40:09 AM
It would be helpful to know what results you get?
Empty?
Number format wrong?

When you view the metadata for one of your files in the Metadata Panel (switch to the Browser layout to see all metadata contained in the file), are the sub second metadata tags filled?

Tip: To try out variables and variable formatting functions, you can use the Var Toy App: Make sure the App Panel is visible and then select this App from the drop-down list in the App Panel.

Mario,

I get an 8 for:

{File.MD.Exif::Main\37520\SubSecTime\0}
{File.MD.Exif::Main\37521\SubSecTimeOriginal\0}
{File.MD.Exif::Main\37522\SubSecTimeDigitized\0}
For instance: 2011-06-10_1337428

So it appears as an incorrect format -it should be 08. or I need to change the variable (default) to something other than /0. I tried a few combinations, but was not lucky.
After more testing, it seems to be any file that has a sub second of 08, all other files are working as one would expect :)... I can send a couple of .NEF files from a D3 to you if you would like.

With 1/100 Second in SS Format I always get a 0
For instance: 2011-06-10_1337420

I double checked last night with Exif tool and just now confirmed in the metadata panel in IMatch 5 Beta that there are entries for all variables of sub sec (time, digitized, original). And thank you for the Var Toy tip!! Very nice  8)

sinus,

Thank you for your help, if you could locate a file with a subsecond of 08 to test, that could shed some light acting as a control.

(attached images).

File 2013-06-26_191748.jpg  shows results using the variables YYYY-MM-DD_HHMMSS & {File.MD.Exif::Main\37520\SubSecTime\0} and shows all image files with a seb second of "08" with a Bold "8" in the preview.

File 2013-06-26_191854.jpg shows the results on all test files using only the variable 1/100 of a Second in SS Format (00-99) and demonstrates that the variable is not working at all with my files showing only "0".

File  2013-06-26_192632.jpg shows the file metadata for Subsec in the exif as "08" subsec time, digitized, and original. This demonstrates that the Metadata panel is reading/interpreting the subsec data and displaying it correctly.

[attachment deleted by admin]

Mario

Maybe I understand you wrong, or what you are trying to achieve. This might be a misunderstanding of what variables actually are.

When you want to use subseconds in your rename definition, I suggest you use the built-in step '1/100 of a Second in SS Format (00-99)'. This step takes care that the metadata is properly formatted. It knows about the format of the value and can process it accordingly.

The sub second variables you list return the content of the metadata tag as-is. If they return '8', that's the value in the file. All variables return text. There are no custom numeric formats for variables except the functions listed in the variables help topic.

I think what you want to do is something like "Assume that the result of this variable is a number, and then format it with a leading zero if the value is < 10". That's not possible with variables. You can only use the tools and functions available for variables, explained in the corresponding help topic. If you think that such a specific functionality would be useful for many users, please add a feature request so I can consider adding a new formatting function for variables in a later IMatch build.
-- Mario
IMatch Developer
Forum Administrator
http://www.photools.com  -  Contact & Support - Follow me on 𝕏 - Like photools.com on Facebook

ThomasAdams

#5
Quote from: Mario on June 27, 2013, 09:12:33 AM
Maybe I understand you wrong, or what you are trying to achieve. This might be a misunderstanding of what variables actually are.

When you want to use subseconds in your rename definition, I suggest you use the built-in step '1/100 of a Second in SS Format (00-99)'. This step takes care that the metadata is properly formatted. It knows about the format of the value and can process it accordingly.

The sub second variables you list return the content of the metadata tag as-is. If they return '8', that's the value in the file. All variables return text. There are no custom numeric formats for variables except the functions listed in the variables help topic.

I think what you want to do is something like "Assume that the result of this variable is a number, and then format it with a leading zero if the value is < 10". That's not possible with variables. You can only use the tools and functions available for variables, explained in the corresponding help topic. If you think that such a specific functionality would be useful for many users, please add a feature request so I can consider adding a new formatting function for variables in a later IMatch build.

Mario,

The exif data is stored as a 2 digit number, always. That is how the camera (all of my cameras) write it.

As stated above, the 1/100 of a second Format (00-99) always returns "0" as pictured in the attached image in the previous post regardless of the recorded sub second time in the exif data.

The other variables are apparently not parsing 08 correctly. They are all dropping the 0. Again, the Metadata panel and Exif tool Command Processor are showing the correct data as "08" - also pictured above and attached here respectively.

Basically, what started out as a question as to how to get the renamer to work has turned into a couple of bug reports as the methods in the renamer are not functioning as expected for some reason on some/all files. I am not sure if it is parsing in IMatch 5, or in the renamer but I can provide sample files if needed to track it down.


From above:

File 2013-06-26_191748.jpg  shows results using the variables YYYY-MM-DD_HHMMSS & {File.MD.Exif::Main\37520\SubSecTime\0} and shows all image files with a seb second of "08" with a Bold "8" in the preview.

File 2013-06-26_191854.jpg shows the results on all test files using only the variable 1/100 of a Second in SS Format (00-99) and demonstrates that the variable is not working at all with my files showing only "0".

File  2013-06-26_192632.jpg shows the file metadata for Subsec in the exif as "08" subsec time, digitized, and original. This demonstrates that the Metadata panel is reading/interpreting the subsec data and displaying it correctly.

File  2013-06-27_203118 copy.JPG also shows the file metadata for Subsec in the exif as "08" subsec time, digitized, and original.

[attachment deleted by admin]

sinus

I checked here quickly some of my nefs.

All Exif-values in the Field "Digitalisierungsdatum/-uhrzeit 1/100 Sekunden" shows values like
00
70
60
10
80

and so on.
This is very curious, because I do never see a value like 77 or 08 (like you) or 65.
I do not know, why this is so (wird da eine Zahl einfach gerundet?), but it is almost impossible, that I do push the button on the camera so exact, that I do have always such plain values (gerade Zahlen).

The second part, the variable {File.MD.Exif::Main\37520\SubSecTime\0} exactly correct, means like the exif-field with 70, 50, 10 and so on with one exception:

Exif: 00
variable: 0

Hope this helps too. BTW: The tested images comes from a Nikon D7000.




Best wishes from Switzerland! :-)
Markus

Mario

#7
The 1/100 of a second step in the Renamer was buggy and I have fixed it. It now returns the proper value.

I checked the EXIF spec and the subsecond tag is a string value of arbitrary length. No specific formatting, e.g. leading 0, is mandatory.
A quick scan of my image collection revealed sub second values like

7
07
125
and even 1763.

(The sub second timings > 100 are from imaging devices used in science/research and for military purposes).
All this is well within the EXIF standard.

The wrong formatting of the variable is because IMatch internally considers sub seconds not as a string but as a number. I explicitly override the text data type to tell IMatch that this is no text but actually a integer number. This allows IMatch to properly sort by this value, among other purposes.

Of course when the text 06 is converted to a number, the leading zero is removed, leaving only the 6. All variables of type number (integer or floating point) format their output according to the number format set for the current user. Which means you get 6 as the result.

I don't want to change the type of the EXIF sub second values back to text. This will cause trouble in several features.

Instead I will add a new variable formatting function, analog to the cast function. I think a function like

format: type, minwidth, decimals

should do the trick. Where

type: int or float
minwidth: the minimum with, optional with leading 0, space, +, -
decimals: for floating point variables, number of decimal places.

For your case:

{File.MD.Exif::Main\37520\SubSecTime\0|format:int,02}

will solve the problem and give you numbers like 00, 05, 08, 24, ...


-- Mario
IMatch Developer
Forum Administrator
http://www.photools.com  -  Contact & Support - Follow me on 𝕏 - Like photools.com on Facebook

cytochrome

#8
It may depend on the camera. I checked directly with Exiftool in my D80 and D7000 NEF: the subsecond tag returns values rounded to the nearest 10, like 00, 10, 20  the same than Sinus reported.

For example, from a D7000 NEF:

Sub Sec Time                    : 40
Sub Sec Time Original           : 40
Sub Sec Time Digitized          : 40

Create Date                     : 2013:03:18 17:38:39.40
Date/Time Original              : 2013:03:18 17:38:39.40
Modify Date                     : 2013:03:18 17:38:39.40

If somebody has a D4 NEF... probably the subsecond will be something like 42 !!

Some camera like the Minolta A1, the Panasonic GF1 don't record any subsecond tags in the Exif

Francis

PS

I found a D4 NEF with Exif on the web. It is the same as with D7000 NEF: subsecond is rounded to the nearest (?) 10.

So either it is Nikon or it is Exiftool who rounds the value.

Mario

This is how I solved this (rather elegantly, and also useful for other tags)...

A new formatting function numformat is available. This function allows you to cast a variable into an int or float type, and to format it with a specific width and decimal places. Optionally the result can be fitted with leading blanks, zeros or +/- sign.

Some examples:



[attachment deleted by admin]
-- Mario
IMatch Developer
Forum Administrator
http://www.photools.com  -  Contact & Support - Follow me on 𝕏 - Like photools.com on Facebook

cytochrome

#10
It is certainly elegant but still obscure to me!!

In the Var Toy that I just discovered (very smart tool...) I entered {File.MD.Exif::Main\37520\SubSecTime\0|numformat:int,04} and got this enigmatic answer: D7K_003196.NEF has 20.8255 MB1010101010

What would it mean ??

Francis

claudermilk

You will need to wait for the next beta release to include the new function Mario just wrote. He's good, but cannot transport new functions to all our PCs instantly.  ;)

cytochrome

Ah, numformat is not already there? Ok, we'll wait.

Nevertheless, how comes that Exiftool shows the Exif  tag 37520 only as tens (00, 10, 20...) ?

Francis

Mario

-- Mario
IMatch Developer
Forum Administrator
http://www.photools.com  -  Contact & Support - Follow me on 𝕏 - Like photools.com on Facebook

Ferdinand

There have been a couple of comments in this thread to the effect that the data is stored in EXIF in a certain format.  I suspect those comments were based on viewing the EXIF in another application.  But I strongly suspect that virtually all these applications apply some kind of formatting to the information, and don't really show you what must be binary information in the EXIF.  For each field there is the question of how to display it in ASCII.  Many times it's obvious but sometimes it's not.

cytochrome

#15
Quote from: Mario on June 29, 2013, 08:16:46 AM
What tag is 37520? What's the name?

Sorry, I  thought 37250 was the code for SubSecTime since you use it in your example. Was a silly shorthand, the Exif code is 0x9290...

In Exiftool I really used something like  exiftool -s -SubSecTime DSC11.NEF WHich returns only values like 00, 10, 20...

@Ferdinand: I used ExiftoolGUI or exiftool.exe in the windows console. There is probably a way to format the exftool output but I haven't found it yet...

Francis

Mario

IMatch currently supports more than 13,000 tags and I cannot keep them all in my head  ;)

The Sub second field is specified as a string of variable length in the EXIF specification. Some cameras write values like "06" but others write "6". ExifTool will return the unmodified string without a specific formatting or minimum width. Sub seconds can also be larger than 99, if the images were taken with very precise gear as used in research or military environments. IMatch can handle such files too.
-- Mario
IMatch Developer
Forum Administrator
http://www.photools.com  -  Contact & Support - Follow me on 𝕏 - Like photools.com on Facebook

cytochrome

Yes, I got this, simply I was surprised that Nikon doesn't do better, even in the D4 Exif.

For the D80 or D7000 subseconds like 00, 10.. are probably fine because they cannot shoot faster (at least in raw mode), but the D4 ?

Francis

Mario

AFAIK the V1 doesn't record sub seconds at all...
-- Mario
IMatch Developer
Forum Administrator
http://www.photools.com  -  Contact & Support - Follow me on 𝕏 - Like photools.com on Facebook

cytochrome

Quote from: Mario on June 29, 2013, 11:28:43 AM
AFAIK the V1 doesn't record sub seconds at all...

.. nor does the Panasonic GF1, my old Minolta A1 and many others. But isn't the D4 supposed to be a "premium"  camera fit for sport event shooting. This may require adequate  sorting of a burst sequence of shots.

Francis