Thursday, July 3, 2014

Embedded EXIF data in IQeye camera images

Exiftool is a PERL utility to read extra metadata from JPEG images. This metadata is often used to store things like camera attributes and even GPS data in modern consumer cameras including phone cameras.

Turns out IQeye cameras write some metadata to images.

Using EXIFtool to view JPEG metadata

$ exiftool -a 09_06_31.trig+00.jpg

Establishing Patterns

For images captured as part of a motion event (FTP'd direct from camera to NAS):

Comment                         : P..L0;exacq1400510841.748exacq
Comment                         : {"IQimage":{"sequence":529057,"time":1400510841748,"event":["motion"],"motionWindows":[2],"imgjdbg":" 291/020:20/480/005:081/107/07/4/50/70/20/17:06/07/06:d4"}}

The first comment, containing the garbage characters, is actually the MAC of the camera. Expressed in HEX, it's something like:

JPEG COM (7 bytes):
    0018: 00 50 1a 02 2c be 3b [.P..,.;]

3b is a product code. This is documented by IQinvision, and I am gathering a list of camera models.

You see that on motion events, there is some extra data after the MAC, flanked with 'exacq'.

If you noticed the curly braces, you may have thought that the second comment is JSON. You'd be right :-)

{
    "IQimage": {
        "sequence": 529057,
        "time": 1400510841748,
        "event": [
            "motion"
        ],
        "motionWindows": [
            2
        ],
        "imgjdbg": " 291/020:20/480/005:081/107/07/4/50/70/20/17:06/07/06:d4"
    }
}

Seems IQinvision has some clever engineers!

Complete Event Sequence

Here is the EXIF metadata for a complete motion event. The first 3 images are "prebuffer" as set in the camera so that we can see the lead-up to the motion event. Highlighted in green is the motion status across the sequence.

11_09_34.trig-03.jpg
Comment                         : P..L0;exacq1399046974.310exacq
Comment                         : {"IQimage":{"sequence":2315889,"time":1399046974310,"event":["none"],"imgjdbg":" 436/067:32/120/016:077/110/01/4/50/60/15/17:21/24/24:bb"}}

11_09_34.trig-02.jpg
Comment                         : P..L0;exacq1399046974.878exacq
Comment                         : {"IQimage":{"sequence":2315898,"time":1399046974878,"event":["none"],"imgjdbg":" 436/067:32/120/016:077/110/01/4/50/60/15/17:21/24/24:bb"}}

11_09_34.trig-01.jpg
Comment                         : P..L0;exacq1399046974.944exacq
Comment                         : {"IQimage":{"sequence":2315899,"time":1399046974944,"event":["none"],"imgjdbg":" 436/067:32/120/016:077/110/01/4/50/60/15/17:21/24/24:bb"}}

11_09_35.trig+00.jpg
Comment                         : P..L0;exacq1399046975.011exacq
Comment                         : {"IQimage":{"sequence":2315900,"time":1399046975011,"event":["motion"],"motionWindows":[1],"imgjdbg":" 436/067:32/120/016:077/110/01/4/50/60/15/17:21/24/24:bb"}}


The last image has the motion, and this is why the status changes. See also that the motion images include the exacq data (timecode) whereas non-motion trigger event JPEGs do not.

The fields are:
  1. sequence - Not sure what this is based on, but it increments
  2. time - precise time
  3. event - type of event (none, trigger, motion)
  4. imgjdbg - unknown

Timelapse Image Sequences

Comment                         : P..,�;
Comment                         : {"IQimage":{"sequence":2380675,"time":1402422546407,"event":["none"],"imgjdbg":" 274/020:16/960/013:083/097/01/4/50/70/20/17:08/09/07:e2"}}
Comment   

Manually Downloaded Images

So far, we've looked at images that are FTPd directly by the camera to storage, both on the periodic basis and motion event basis.

So, what happens if you download now.jpg when there is a trigger occurring in the image? In the case of using the http://camera/now.jpg feature of IQeye cameras.

Well, you also get trigger data!

$ exiftool -a now\ \(1\).jpg |grep Comment
Comment                         : P..,�;
Comment                         : {"IQimage":{"sequence":20980184,"time":1404396373253,"event":["motion"],"motionWindows":[7],"imgjdbg":" 298/016:22/480/008:085/099/01/4/55/70/20/17:06/09/06:47"}}

$ exiftool -a now\ \(2\).jpg |grep Comment
Comment                         : P..,�;
Comment                         : {"IQimage":{"sequence":20980241,"time":1404396378202,"event":["motion"],"motionWindows":[6],"imgjdbg":" 298/016:22/480/008:085/099/01/4/55/70/20/17:06/09/06:47"}}

$ exiftool -a now\ \(3\).jpg |grep Comment
Comment                         : P..,�;
Comment                         : {"IQimage":{"sequence":20980453,"time":1404396395825,"event":["motion"],"motionWindows":[6],"imgjdbg":" 298/016:22/480/008:085/099/01/4/55/70/20/17:06/09/06:47"}}

Surprisingly, none of this is documented in the IQeye reference manuals...and I've been very impressed with their customer service and documentation. I've reached out to them for some more explanation of what that imgjdbg tag is.

No comments:

Post a Comment