Skip to content

Commit 43c116e

Browse files
committed
Added support for MicroVideoOffset
MicroVideoOffset is used by Google Motion Photos to indicate position of video in jpg
1 parent 76cf218 commit 43c116e

File tree

2 files changed

+30
-0
lines changed

2 files changed

+30
-0
lines changed

lib/PHPExif/Exif.php

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ class Exif
5959
const CONTENTIDENTIFIER = 'contentIdentifier';
6060
const FRAMERATE = 'framerate';
6161
const DURATION = 'duration';
62+
const MICROVIDEOOFFSET = 'MicroVideoOffset';
6263

6364
/**
6465
* The mapped EXIF data
@@ -1153,4 +1154,31 @@ public function getDuration()
11531154

11541155
return $this->data[self::DURATION];
11551156
}
1157+
1158+
/**
1159+
* Sets the duration value
1160+
*
1161+
* @param string $value
1162+
* @return \PHPExif\Exif
1163+
*/
1164+
public function setMicroVideoOffset($value)
1165+
{
1166+
$this->data[self::MICROVIDEOOFFSET] = $value;
1167+
1168+
return $this;
1169+
}
1170+
1171+
/**
1172+
* Returns duration, if it exists
1173+
*
1174+
* @return string|boolean
1175+
*/
1176+
public function getMicroVideoOffset()
1177+
{
1178+
if (!isset($this->data[self::MICROVIDEOOFFSET])) {
1179+
return false;
1180+
}
1181+
1182+
return $this->data[self::MICROVIDEOOFFSET];
1183+
}
11561184
}

lib/PHPExif/Mapper/Exiftool.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ class Exiftool implements MapperInterface
6060
const LENS = 'ExifIFD:LensModel';
6161
const SUBJECT = 'XMP-dc:Subject';
6262
const CONTENTIDENTIFIER = 'Apple:ContentIdentifier';
63+
const MICROVIDEOOFFSET = 'XMP-GCamera:MicroVideoOffset';
6364

6465
const DATETIMEORIGINAL_QUICKTIME = 'QuickTime:CreationDate';
6566
const IMAGEHEIGHT_VIDEO = 'Composite:ImageSize';
@@ -135,6 +136,7 @@ class Exiftool implements MapperInterface
135136
self::FRAMERATE_QUICKTIME_3 => Exif::FRAMERATE,
136137
self::DURATION => Exif::DURATION,
137138
self::DURATION_QUICKTIME => Exif::DURATION,
139+
self::MICROVIDEOOFFSET => Exif::MICROVIDEOOFFSET,
138140
);
139141

140142
/**

0 commit comments

Comments
 (0)