need help copying DateTimeOriginal from .mov to AllDates .jpg

Started by jbourgui, March 07, 2012, 03:34:41 PM

Previous topic - Next topic

jbourgui

As the subject says, I'm trying to copy all date/time info from a file, say MVI_1234.MOV to MVI_1234.jpg for an entire recursive directory structure of movies and associated jpegs.  So, in case that isn't clear, I want to:

Read original creation date from file MVI_1234.MOV and set AllDates for MVI_1234.jpg to that value.

I have tried several command line variations but can't seem to get the right values yet...  Help a newbie!?!  :)

This seemed like a useful example but yielded no results:
       exiftool −tagsfromfile %d%f.CRW −r −ext JPG dir
            Recursively rewrite all "JPG" images in "dir" with information
            copied from the corresponding "CRW" images in the same
            directories.

Is that a windows command line with the %'s?  I'm on Mac OSX fyi.

I have tried:

exiftool -DateTimeOriginal %d%f.MOV -r ext jpg dir
exiftool -DateTimeOriginal *.MOV -r ext jpg *
exiftool -DateTimeOriginal *.MOV -r -ext jpg *
exiftool -DateTimeOriginal- *.MOV -ext jpg .
exiftool '-DateTimeOriginal' *.MOV -ext jpg .

Thanks!!

-joe

Phil Harvey

Hi Joe,

Try this:

exiftool -tagsfromfile %d%f.MOV "-datetimeoriginal<createdate" -r -ext jpg DIR

Here I have copied the CreateDate from the MOV to DateTimeOriginal of the JPG.  I have done this because this is where the time tends to be stored in MOV videos.

Here is a breakdown of the command:

-tagsfromfile %d%f.MOV - copy tags from the file in the same directory (%d) and with the same filename (%f) as the source file, but with the extension .MOV.

"-datetimeoriginal<createdate" - Copy CreateDate to DateTimeOriginal.

-r - also process sub-directories

-ext jpg - only process source files with the extension .jpg or .JPG

- Phil

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

jbourgui

Phil, thanks so much for you FAST reply!  I ended up using the two commands below for the desired effect.  Not sure if they can be combined into one?  Thanks again!

exiftool -tagsfromfile %d%f.MOV "-datetimeoriginal<createdate" -r -ext jpg .
exiftool '-DateTimeOriginal>FileModifyDate' -r .

Cheers,

-joe

Phil Harvey

Hi Joe,

For JPG files, this can be done in a single command:

exiftool -tagsfromfile %d%f.MOV "-datetimeoriginal<createdate" "-filemodifydate<createdate" -r -ext jpg .

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

jbourgui

That's great!!  Exiftool is amazingly powerful.  I'm generally quite good with command line stuff and some regexp but I'm only scratching the surface of your utility!  :) 

Is there a way to shift the time in the same command?  Say +14 hours?

I tried:
exiftool -tagsfromfile %d%f.MOV "-datetimeoriginal+=14<createdate" "-filemodifydate+=14<createdate" -r -ext jpg .
AND
exiftool -tagsfromfile %d%f.MOV "-datetimeoriginal<createdate+=14" "-filemodifydate<createdate+=14" -r -ext jpg .


ALSO, is there a way to set the file system (not metadata) creation/modification/last opened dates all to equal datetimeoriginal?

Cheers,

-joe

Phil Harvey

Hi Joe,

You can copy date/time values or shift them, but you can't easily do both in the same command.  (To do this in one step would require you to create a user-defined tag, which isn't all that convenient.)

So just copy the times, then use -TAG+=14 in a separate command to increment the date/times by 14 hours.

The FileModifyDate tag gives you read/write access to the filesystem modification date/time, but unfortunately there is no way to read/write the filesystem creation date/time directly.

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

jbourgui

Cool.  Thanks for all of the fast detailed responses, Phil!   ;D

Cheers,

-joe