9

How to get camera serial number from EXIF ?


Edit: some folk think that not all (or even many) cameras store serial number, but I tried four from different manufacturers and they do. So, let's just rephrase it as "How to get camera serial number from EXIF if there is any?"

James A Mohler
  • 11,060
  • 15
  • 46
  • 72
Mawg says reinstate Monica
  • 38,334
  • 103
  • 306
  • 551
  • 1
    FWIW: http://cameratrace.com/faq shows a long list of cameras that do store serial numbers in the EXIF. – EricLaw Jan 16 '13 at 17:32

4 Answers4

22

As has been mentioned, not all cameras store the serial number. However, most of the DSLRs do.

The serial number is actually stored in the MakerNotes section of the EXIF. This is a proprietary section for manufacturers to write in whatever format they like.

I've extended the great work by Jacob Seidelin (< edit: the URL is a 404) to extract the serial number with javascript on my Site which includes an offline version for Chrome for no other reason than to see if I could! It's open source so if you're looking for a javascript solution you're welcome to build on it etc.

The question doesn't include a programming language or any contsraints so the best answer currently is to use exiftool. It has the most complete support for different camera models and file formats (including brilliant support for how different applications butcher it!)

A simple example command to get the serial number would be:

exiftool -SerialNumber myImage.jpg

I writing my site, I've looked into this topic over hundreds of hours so if you have any more questions, let me know!

Funk Forty Niner
  • 74,450
  • 15
  • 68
  • 141
matt burns
  • 24,742
  • 13
  • 105
  • 107
4

Almost all DSLR cameras code the serial number into the EXIF info in the maker notes section. The reason most people don't see it in the EXIF info is that Adobe products all but ignore the maker notes section of the EXIF info. So if you are viewing the EXIF info using an Adobe product you won't see the serial number. But that doesn't mean it isn't there, it just means Adobe isn't displaying it.

Michael C
  • 141
  • 3
2

First the camera would have to write its serial number to the EXIF data. I don't know of any that do.

But in any event, you'll have to check with the documentation of the specific camera in question to see if it writes this value and where it writes it. There's no standard place for it, since it's not a standard thing to write (such as Manufacturer or Model).

You can see a lot about the EXIF specifications here.

David
  • 208,112
  • 36
  • 198
  • 279
  • 1
    I found the Q&A from a Google for a recent question and clicked on the embedded URL which is now a 404 David. The new URL for it now is http://www.exif.org/category/specifications unless you want to point it to just http://www.exif.org/ – Funk Forty Niner Aug 23 '17 at 00:44
1

You can use exif_read_data to access EXIF information in php. A good code sample on how to use this command is shown in the manual within the link below.

http://www.php.net/manual/en/function.exif-read-data.php

But afaik currently not many cameras code the serial numbers into the EXIF blocks.

Bjoern
  • 15,934
  • 4
  • 43
  • 48