FileNumber semantics difference between Canon and Nikon (composite vs native?)

Started by Martin B., January 04, 2016, 05:34:12 PM

Previous topic - Next topic

Martin B.

Hi,

I'm getting different FileNumber semantics between Canon and Nikon images. I'm guessing this is because both have a native FileNumber (tag 0x0008 in http://www.exiftool.org/TagNames/Canon.html, and tag 4 of Nikon FileInfo in http://www.exiftool.org/TagNames/Nikon.html#FileInfo), but there's also a Composite:FileNumber, derived from DirectoryIndex and FileIndex (see for instance http://www.exiftool.org/TagNames/Canon.html#CameraInfo450D), which seems to exist only for Canon.

Is this the intended behavior? The difference in Filenumber/FileIndex meaning between Canon and Nikon is a bit confusing.
Is there a combination of options that can be used to have the same result (i.e. nnn-nnnn) for both types of cameras? For all cameras?

This is what I get with sample files:
The Canon FileNumber is reported as 101-0469.
The Nikon Filenumber is reported as 0001 (i.e. not prefixed by the directory number).
>exiftool -model -fileindex -filenumber -directorynumber -directoryindex .
======== ./CanonXSi.CR2
Camera Model Name               : Canon EOS DIGITAL REBEL XSi
File Index                      : 469
File Number                     : 101-0469
Directory Index                 : 101
======== ./NikonD60.NEF
Camera Model Name               : NIKON D60
File Number                     : 0001
Directory Number                : 101


I tried forcing the use of the composite tag, but then nothing gets printed for Nikon images (probably because FileNumber requires DirectoryIndex and FileIndex, which Nikon doesn't have):
>exiftool -model -Composite:filenumber .
======== ./CanonXSi.CR2
Camera Model Name               : Canon EOS DIGITAL REBEL XSi
File Number                     : 101-0469
======== ./NikonD60.NEF
Camera Model Name               : NIKON D60


Setting the Nikon FileNumber with a "composite" format (nnn-nnnn) silently fails:
>exiftool -model -filenumber -directorynumber NikonD60.NEF
Camera Model Name               : NIKON D60
File Number                     : 0001
Directory Number                : 101

>exiftool -filenumber=102-0002 NikonD60.NEF
    0 image files updated
    1 image files unchanged

>exiftool -model -filenumber -directorynumber NikonD60.NEF
Camera Model Name               : NIKON D60
File Number                     : 0001
Directory Number                : 101


Setting it with a "normal" format (nnnn) succeeds, but with a warning message stating it's an invalid Composite:FileNumber:
>exiftool -model -filenumber -directorynumber NikonD60.NEF
Camera Model Name               : NIKON D60
File Number                     : 0001
Directory Number                : 101

>exiftool -filenumber=0002 NikonD60.NEF
Warning: Invalid format for Composite:FileNumber
    1 image files updated

>exiftool -model -filenumber -directorynumber NikonD60.NEF
Camera Model Name               : NIKON D60
File Number                     : 0002
Directory Number                : 101


Thanks for any help or explanation you can provide,

Martin

Phil Harvey

Hi Martin,

In general you can't expect consistency between the maker notes of different brands, although in this case ExifTool could have been a bit more consistent in the naming of the tags.

For reading, you can of course create a user-defined tag to do what you want.  It seems that you want to derive this from Canon:FileIndex and Nikon::FileNumber, and just take the one that is available for a given file.

For writing, a silent failure indicates that the tag was assigned a valid value, but that the file you wrote didn't support the tag you assigned.  Add -v3 for more information when writing.

- 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 ($).

Martin B.

Hi Phil,

Thanks for the explanation.

I get your point about the maker notes inconsistencies; not much anyone can do about that.

However, it doesn't seem right to me that exiftool issues this warning about the Composite:FileNumber when writing a Nikon "native" FileNumber with the correct format:
>exiftool -filenumber=0002 NikonD60.NEF
Warning: Invalid format for Composite:FileNumber

But I can live with a user-defined tag, so I'll try to define one.

Thanks again!

Martin

Phil Harvey

Hi Martin,

This may be more clear if you understand how ExifTool writes information.  It is designed to write to multiple images at once, so it doesn't care what type of file you are planning to write when you assign a tag value.  The -v2 option will show you something like this:

> exiftool a.jpg -filenumber=0002 -v2
Writing Nikon:FileNumber if tag exists
Writing Canon:FileNumber if tag exists
Writing CanonRaw:FileNumber if tag exists
Writing Canon:FileNumber if tag exists
Writing Canon:FileNumber if tag exists
Warning: Invalid format for Composite:FileNumber
======== a.jpg  <-- at this point ExifTool begins processing of the first file, but the warning has already been issued
Rewriting a.jpg...


If you know you are writing a Nikon file and you want to avoid the warning, then you could use Nikon:FileNumber instead of just FileNumber.

- 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 ($).