Movie Timestamp Work

This article is a ‘nutshell’ and assumes rough familiarity with the concepts involved. I use it to refer back to : ). It is also Incomplete : )

I have some old phone videos from 2012 whose FILE timestamp is roughly right (IE:: AROUND that Christmastime) but the video camera used- a Palm Treo I think- did not store EXIF internal metadata about this. All time  fields were set to Zero.
My MAC PHOTOS software uses the EXIF date/time stamps to help order the pictures chronologically.
I got EXIFTOOL command line tool from here
(NO graphical interface, but All the Power in the World)
https://exiftool.org/
and Set to Work. (also available for distributions like brew, apt, yum…

Task: Set the missing INTERNAL EXIF timestamps to match that of the file creation date.
This was likely not actually when the camera took them, but rather when they ended up on an old PC, closer to the real time than ‘now’
For full file info for my demo file “Various2011and2012_009.mov”

$exiftool Various2011and2012_009.mov
(long resulting printout)
Here is one example for the ls -l Command::
2686011 Jan 16 2012 Various2011and2012_009.mov
(NOTE: arguments to exiftool do not care about upper and lowercase)
$exiftool -alldates Various2011and2012_009.mov
Create Date : 0000:00:00 00:00:00
Modify Date : 0000:00:00 00:00:00
a full print out reports (snip) also:
Media Create Date : 0000:00:00 00:00:00
Media Modify Date : 0000:00:00 00:00:00
so there are at least FOUR places within the video where time stamps are used. As I do not know which one(s) that MAC PHOTOS uses, I shall change them ALL to that of whatever the file timestamp itself is:

exiftool “-AllDates<FileModifyDate” Various2011and2012_009.mov
1 image files updated

(that’s one line) look closely within the single-quotes: it reads like:
“Get alldates FROM (<) the FileModifyDate” 
(alldates actually refers to just 2 mains dates: Create and Modify, there are more…)
Wildcards work, too
exiftool “-AllDates<FileModifyDate” *.mov

HEre is the effect of that:

2686003 Oct 14 23:51 Various2011and2012_009.mov
2686011 Jan 16 2012 Various2011and2012_009.mov_original

TWO files, the Original and the Modified with a very slightly different size due to added 8 bytes of binary data- and NOTE the modified file NOW has the present timestamp on – because it just got written to!
But we will Deal With That In A Moment:
There are 2 more timestamps I want to Change
MediaCreateDate and MediaModifyDate
Well– that’s easy.

$exiftool ‘-mediacreatedate<createdate’ Various2011and2012_009.mov
1 image files updated

$exiftool ‘-mediamodifydate<modifydate’ Various2011and2012_009.mov
1 image files updated

The File Timestamp is ‘now’ so! let’s set that back to what it was,
just for fun:
$exiftool ‘-filemodifydate<createdate’ Various2011and2012_009.mov
1 image files updated

So there you have it– everything your album software wants to know about Timestamps it has it. Not so much when the image was made as when it was copied somewhere. With luck it COULD be the actual Time it was Taken

NOTE: I have done nothing here about time zones etc etc.
Also– Note that if you are COPYING files under, for example, Linux– be sure to use the Archive or Preserve flag so the copied file is not timestamped ‘now’, IE:
$cp -av fileA.mov fileB.mov
 So YES work on COPIES of the precious old videos, please!
Want to do these steps on a mass of files? Something like:
$exiftool ‘-alldates<FileModifyDate’ *.mov

As a side-note– for un recalled reasons, all there videos were rotated 90 degrees. MAC PHOTOS can rotate still images, not videos, so I used FFMPEG which *also*  converted the rotated videos to the more efficient .mp4 format. Extra parematers are needed to ensure the timestamps get copied over…

$ffmpeg -i Various2011and2012_009.mov -vf “transpose=1” -map_metadata 0 Various2011and2012_009.mp4

(LONG screed of Blurb… 🙂

_metadata 0 Note the “-map_metadata 0” arg. without this you will LOSE the timestamp in conversion?!
So YES this will mess up the file timestamp and YES ffmpeg preserves the EXIF internal times stamps during conversion- making the file up to 10 times smaller with no noticeable degradation

I threw that in as an aside almost, to show command lines are extremely powerful but can be user-hostile : )

HERE is the Batch File used to mass rotate

for name in *.mov; do
echo FileName: \”$f\”
ffmpeg -nostdin -y -i $name -vf transpose=1 -map_metadata 0 ${name%.*}.mp4
done

IF you are on a MAC, all this is possible using the BREW system described here:

https://brew.sh/
which tells you to do like:
$ /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
FOLLOW  THE INSTRUCTIONS there Closely, BE PATIENT then perform:

brew install exiftool

brew install ffmpeg

and you are in business.
I have said nothing here about converting stuff in batches– s separate Projects elsewhere and requiring “bash scripts’ or the like

ls -la
Linux: It’s even easier. |
Use your package installer.
Windows– similar, I suppose but I have not tried it

 Please contact me with any Questions– this is a Nutshell or Outline

 

Leave a Reply

Your email address will not be published. Required fields are marked *