fix(metadata): support the ContentCreateDate field for videos

pull/134/head
Romain 6 years ago
parent c29a16ed83
commit b15b10fbb9

@ -53,6 +53,7 @@ function getDate (exif) {
function getMetaDate (exif) {
const date = tagValue(exif, 'EXIF', 'DateTimeOriginal') ||
tagValue(exif, 'H264', 'DateTimeOriginal') ||
tagValue(exif, 'QuickTime', 'ContentCreateDate') ||
tagValue(exif, 'QuickTime', 'CreationDate') ||
tagValue(exif, 'QuickTime', 'CreateDate')
if (date) {

@ -32,6 +32,16 @@ describe('Metadata', function () {
should(meta.date).eql(fixtures.date('2016-10-28 17:34:58').getTime())
})
it('prefers the ContentCreateDate field if present', function () {
// when exporting a movie from the macOS Photos app, it sets
// CreateDate=date_of_export and ContentCreateDate=date_taken
const exiftool = fixtures.exiftool()
exiftool.QuickTime.CreateDate = '2016:10:28 17:34:58' // EXIF date format
exiftool.QuickTime.ContentCreateDate = '2016:09:02 10:25:41' // EXIF date format
const meta = new Metadata(exiftool)
should(meta.date).eql(fixtures.date('2016-09-02 10:25:41').getTime())
})
it('infers the date from the filename (Android format)', function () {
const exiftool = fixtures.exiftool()
exiftool.SourceFile = 'folder/VID_20170220_114006.mp4'

Loading…
Cancel
Save