TimeShift in filename based on the wrong time of picture creation

Advanced Renamer forum
#1 : 04/10-21 03:28
Zdenek Drska
Zdenek Drska
Posts: 2
Hi guys,
I am trying to sort out thousands of pictures om our taking on few different cameras and my phone. Traveling through Australia, you don't have constant coverage, so your phone changes it's location when on the signal, but that's usually nowhere at the real spot, with only one of my cameras having GPS chip.
So I started with one folder form 2009 and converted all the pictures in Advanced Renamer by the originally taken time from Exif, so my new file name is yyyy_MM_dd hh_mm_dd_ss_originalfilename_devicetaken and that's it to sort it all out.
But I have some movies MOV, which still have Exif, but in different form and the data of the original file are in three section there, so even if I knew that I can change them, will I have to change all of them? This old camera was badly set up and the pictures are 6:39:11 sec backwards. There is no way of changing this in the file name in this program or, actually anywhere else, if I am not mistaken, as a batch rename. And that's only beginning of my work.
So I believe, it could be easily done by the javascript, but instead learning the whole thing, could I found anyone to write me the script which we could also publish?
The original Exif of my video I can send later.

Thank you very much,
regards, Sidney


04/10-21 03:28
#2 : 04/10-21 14:47
David Lee
David Lee
Posts: 1125
I'm afraid that your question about your MOV files does not make any sense to me. However it is straightforward to correct the time in a filename using a script.

I'm assuming that there is a typo in your filename format and it should be "yyyy_MM_dd hh_mm_ss_originalfilename_devicetaken" and you want to add 6h 39m 11s to each time stamp.

The procedure is to extract the date & time fields and following text using a regular expression.
Parse the time/date fields into a Unix timestamp.
Add the time correction in milliseconds.
Finally extract the date & time fields from the corrected Unix timestamp and add the filename text.

Use a Script method...

Copy the following code into the Pre batch script:

// TIME CORRECTION IN MILLISECONDS
timeCorrection = 1000 * ((((6*60)+39)*60)+11);

And this code into the main script window:

// SET TIME CORRECTION IN PRE-BATCH SCRIPT
D = item.name.match(/^(\d{4})_(\d{2})_(\d{2}) (\d{2})_(\d{2})_(\d{2})(.*)/);
oldDate = Date.parse(D[1] + '-' + D[2] + '-' + D[3] + 'T' + D[4] + ':' + D[5] + ':' + D[6]);
newDate = new Date(oldDate + timeCorrection);
return newDate.getUTCFullYear()
+ '_' + ('0' + (newDate.getUTCMonth() + 1)).slice(-2)
+ '_' + ('0' + newDate.getUTCDate()).slice(-2)
+ ' ' + ('0' + newDate.getUTCHours()).slice(-2)
+ '_' + ('0' + newDate.getUTCMinutes()).slice(-2)
+ '_' + ('0' + newDate.getUTCSeconds()).slice(-2)
+ D[7];


04/10-21 14:47
#3 : 05/10-21 04:11
Zdenek Drska
Zdenek Drska
Posts: 2
Reply to #2:
Hi,
I is making sense to me to sort out my pictures, because most programs can sort it based on the filename. Of course, it does not solve the problem completely, it would need the time changed in the right part of the MOV Exif, but I could not find how or even if it works...
I am sending the Exif here, sorry for the space taken:

ExifTool Version Number : 12.31
File Name : 2009_08_11 07_36_41_Minolta_SX749_PICT9854_v1.MOV
Directory : C:/PICS/test
File Size : 13 MiB
File Modification Date/Time : 2018:12:08 18:22:50+08:00
File Access Date/Time : 2021:10:05 09:42:09+08:00
File Creation Date/Time : 2021:10:03 12:34:01+08:00
File Permissions : -rw-rw-rw-
File Type : MOV
File Type Extension : mov
MIME Type : video/quicktime
Preview Date : 2009:08:11 00:57:30
Preview Version : 0
Preview Atom Type : PICT
Preview Atom Index : 1
Preview PICT : (Binary data 2776 bytes, use -b option to extract)
Media Data Size : 13102080
Media Data Offset : 2812
Movie Header Version : 0
Create Date : 2009:08:11 00:57:30
Modify Date : 2009:08:11 00:57:30
Time Scale : 600
Duration : 12.67 s
Preferred Rate : 1
Preferred Volume : 99.61%
Preview Time : 0 s
Preview Duration : 0 s
Poster Time : 0 s
Selection Time : 0 s
Selection Duration : 0 s
Current Time : 0 s
Next Track ID : 2
Track Header Version : 0
Track Create Date : 2009:08:11 00:57:30
Track Modify Date : 2009:08:11 00:57:30
Track ID : 1
Track Duration : 12.67 s
Track Layer : 0
Track Volume : 0.00%
Image Width : 640
Image Height : 480
Graphics Mode : ditherCopy
Op Color : 32768 32768 32768
Compressor ID : jpeg
Vendor ID : Minolta
Source Image Width : 640
Source Image Height : 480
X Resolution : 72
Y Resolution : 72
Compressor Name : Photo - JPEG
Bit Depth : 24
Video Frame Rate : 30
Matrix Structure : 1 0 0 0 1 0 0 0 1
Media Header Version : 0
Media Create Date : 2009:08:11 00:57:30
Media Modify Date : 2009:08:11 00:57:30
Media Time Scale : 7875
Media Duration : 12.67 s
Balance : 0
Handler Class : Data Handler
Handler Type : Alias Data
Handler Vendor ID : Minolta
Audio Format : raw
Audio Channels : 1
Audio Bits Per Sample : 8
Audio Sample Rate : 7875
Format : Digital Camera
Information : MINOLTA DIGITAL CAMERA
Make : MINOLTA DIGITAL CAMERA
Model Type : SX749
Exposure Time : 1/320
F Number : 5.6
Exposure Compensation : 0
Focal Length : 5.8 mm
Aperture : 5.6
Image Size : 640x480
Megapixels : 0.307
Shutter Speed : 1/320
Avg Bitrate : 8.27 Mbps
Rotation : 0
Focal Length : 5.8 mm
-- press ENTER --

Most picture programs will touch the media create day (Exif) at the first place, but I am really sorry for my ignorance, I do not know, which one even need to be changed, or maybe all of them? There are tripled there in different section and different names. Not alike with photos.
Thanks to your help, I can now batch change my folder data, and the question remains, if I can write them to the Exif or visa versa, but I was not able to find any ways to do it in MOV. And I have tried over 10 programs... I think it's terrible that nobody was thinking of wrongly put times, creating this system...
Please, if you know how to fix the data in Exif, in any program, let me know.
Or could the javascript help here as well?
I have lots more to do, but I should be able to do most of it in Advanced Renamer, this is just the movies, troubling my life...

Thanks again!
Sid


05/10-21 04:11