other Narrative Clip data

Started by chuckkahn, May 11, 2014, 02:41:54 PM

Previous topic - Next topic

chuckkahn

Each jpeg on the Narrative Clip has a corresponding .json file of the same name in a subfolder called 'meta'.

For example, the EXIF-less file "210506.jpg" is paired with "meta/210506.json"   

{
"mag_data": { "samples":[[-71, 405, 1085]] },
"acc_data": { "samples":[[2286, -1206, 360]] },
"trigger": "timer",
"fw_version": "v0.7.2",
"avg_win": [ 30, 27, 114, 105, 33, 37, 105, 95, 34, 28, 25, 25, 31, 23, 21, 18 ],
"bat_level": 224,
"avg_readout": 48,
"light_meter": 5289
}


I understand that "acc_data" is the accelerometer data, which indicates the position of the camera and necessitates the need for a rotation of the jpeg, which can be performed as such:

exiftool -n -orientation=8 ~/Pictures/Narrative\ Clip/2014/05/02/210506c.jpg


But does anyone recognize the other lines of the .json file as translate-able into EXIF data that Exiftool can put into the jpeg?

P.S.:  I see there's a JSON import option in Exiftool, but the .json format Exiftool generates is different than Narrative Clip's.

exiftool -json ~/Pictures/Narrative\ Clip/2014/05/02/210506c.jpg
[{
  "SourceFile": "/Users/chuckkahn/Pictures/Narrative Clip/2014/05/02/210506c.jpg",
  "ExifToolVersion": 9.59,
  "FileName": "210506c.jpg",
  "Directory": "/Users/chuckkahn/Pictures/Narrative Clip/2014/05/02",
  "FileSize": "502 kB",
  "FileModifyDate": "2014:05:11 14:16:11-04:00",
  "FileAccessDate": "2014:05:11 14:47:21-04:00",
  "FileInodeChangeDate": "2014:05:11 14:16:18-04:00",
  "FilePermissions": "rw-r--r--",
  "FileType": "JPEG",
  "MIMEType": "image/jpeg",
  "JFIFVersion": 1.01,
  "ExifByteOrder": "Big-endian (Motorola, MM)",
  "Orientation": "Rotate 270 CW",
  "XResolution": 0,
  "YResolution": 0,
  "ResolutionUnit": "inches",
  "ModifyDate": "2014:05:02 17:05:06",
  "YCbCrPositioning": "Centered",
  "ExifVersion": "0230",
  "DateTimeOriginal": "2014:05:02 17:05:06",
  "CreateDate": "2014:05:02 17:05:06",
  "ComponentsConfiguration": "Y, Cb, Cr, -",
  "FlashpixVersion": "0100",
  "ColorSpace": "Uncalibrated",
  "XMPToolkit": "Image::ExifTool 9.59",
  "ImageWidth": 2592,
  "ImageHeight": 1944,
  "EncodingProcess": "Baseline DCT, Huffman coding",
  "BitsPerSample": 8,
  "ColorComponents": 3,
  "YCbCrSubSampling": "YCbCr4:2:2 (2 1)",
  "ImageSize": "2592x1944"
}]


P.P.S.:  Along with the .json file, there's a .snap file (example attached) that contains GPS info.  I think.  So would that be readable by the -geotag TRKFILE command?

P.P.P.S: It seems .snap is not readable with this command.

exiftool -geotag /Users/chuckkahn/Pictures/Narrative\ Clip/2014/05/02/meta/210506.snap  ~/Pictures/Narrative\ Clip/2014/05/02/210506c.jpg

Warning: No track points found in GPS file '/Users/chuckkahn/Pictures/Narrative Clip/2014/05/02/meta/210506.snap' in File:Geotag (ValueConvInv)
Warning: GPS track is empty in File:Geotime (ValueConvInv) - /Users/chuckkahn/Pictures/Narrative Clip/2014/05/02/210506c.jpg
Warning: No writable tags set from /Users/chuckkahn/Pictures/Narrative Clip/2014/05/02/210506c.jpg
    0 image files updated
    1 image files unchanged


Phil Harvey

The only differences between your JSON file and ExifTool's are:

1) ExifTool requires a SourceFile entry (set to "*" to match any source file name).

2) The dictionary keys in the ExifTool JSON file must be tag names.

To satisfy 2, you could create a set of user-defined XMP tags with names that match your Narrative Clip JSON file.  See the XMP-xxx namespace in the sample config file for an example of how to do this.

- Phil

P.S. I took a look at your .snap file, and I don't recognize the format.
...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 ($).

chuckkahn

Quote from: Phil Harvey on May 11, 2014, 03:05:41 PM
The only differences between your JSON file and ExifTool's are:

1) ExifTool requires a SourceFile entry (set to "*" to match any source file name).

2) The dictionary keys in the ExifTool JSON file must be tag names.

To satisfy 2, you could create a set of user-defined XMP tags with names that match your Narrative Clip JSON file.  See the XMP-xxx namespace in the sample config file for an example of how to do this.

- Phil

P.S. I took a look at your .snap file, and I don't recognize the format.


Reading and decoding the .json file as a hash and then trying to assign that as a user-defined XMP:NarrClip hierarchy in one slurp.

A quote from https://github.com/chuckkahn/Narrative-Clip-Metadata/blob/master/narrative_meta.pl

my $exifTool = new Image::ExifTool;
$exifTool->SetNewValue('XMP:NarrClip' => $decoded );
$exifTool->WriteInfo($sfile);


Output ends with "Sorry, XMP:NarrClip is not writable":

Custom ExifTool config Narrative_XMP.cfg loaded!
    1 image files updated
    1 image files updated
    1 image files updated
    1 image files updated
/Users/chuckkahn/Pictures/Narrative Clip/2014/05/02c/meta/210506.json

{
"mag_data": { "samples":[[-71, 405, 1085]] },
"acc_data": { "samples":[[2286, -1206, 360]] },
"trigger": "timer",
"fw_version": "v0.7.2",
"avg_win": [ 30, 27, 114, 105, 33, 37, 105, 95, 34, 28, 25, 25, 31, 23, 21, 18 ],
"bat_level": 224,
"avg_readout": 48,
"light_meter": 5289
}

JSON=HASH(0x7fa2420f2a18)
HASH(0x7fa242103348)
fw_version is v0.7.2
Sorry, XMP:NarrClip is not writable

Phil Harvey

I could help if you show me the config file you are using.  Did you take a look at the XMP-xxx example in the sample config file?  This is what you should model your new tag definitions from.

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

chuckkahn

I've been studying the xxx example of the same config file.   

I'm using this config:

# Description:  user configuration file of XMP custom tags for Image::ExifTool

print "Custom ExifTool config Narrative_XMP.cfg loaded!\n";

# new XMP namespaces (ie. xxx) must be added to the Main XMP table:

%Image::ExifTool::UserDefined = (
    'Image::ExifTool::XMP::Main' => {
        NarrClip => {
            SubDirectory => {
                TagTable => 'Image::ExifTool::UserDefined::NarrClip',
            },
        },
    },
);

%Image::ExifTool::UserDefined::NarrClip = (
    GROUPS => { 0 => 'XMP', 1 => 'XMP-NarrClip', 2 => 'Image' },
    NAMESPACE => { 'NarrClip' => 'http://ns.myname.com/xxx/1.0/' },
    WRITABLE => 'string',
    tags => { List => 'NarrMeta' },

);
1; # end


Full config is at https://github.com/chuckkahn/Narrative-Clip-Metadata/blob/master/Narrative_XMP.cfg but I chopped off the commented example lines at the end of the file

Phil Harvey

You can defined a "NarrClip" namespace with a single tag called "tags" (which has an invalid "List" type, btw).

You need to define tags to match the names in your JSON file ("mag_data", etc).

I'm still a bit unclear about how you want the XMP formatted.  From your JSON example it looks like mag_data and acc_data are structures containing an array of arrays.  It will be tricky to read like this.  avg_win is a simple array, and may be read into a List-type tag by specifying List => 'Seq', in the tag definition.

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

chuckkahn

Quote from: Phil Harvey on May 25, 2014, 03:33:12 PM
You can defined a "NarrClip" namespace with a single tag called "tags" (which has an invalid "List" type, btw).

You need to define tags to match the names in your JSON file ("mag_data", etc).

I'm still a bit unclear about how you want the XMP formatted.  From your JSON example it looks like mag_data and acc_data are structures containing an array of arrays.  It will be tricky to read like this.  avg_win is a simple array, and may be read into a List-type tag by specifying List => 'Seq', in the tag definition.

- Phil

What does "Groups => " in the example config file do?

The RegionInfo example at  http://www.exiftool.org/struct.html#Serializel has structures containing arrays of arrays (W is within Area is within RegionList) -- it differs in that the INFILE is not in the same format as the .json text files I'm working with.   

Phil Harvey

Quote from: chuckkahn on June 01, 2014, 05:18:21 PM
What does "Groups => " in the example config file do?

Defines the ExifTool groups that the tag belongs to.

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