Fixing the date with GPS time - for beginners

Hi,
Many devices have the tendency to reset their date/time when they lose power for a moment. If you’re not careful, your device will save the pictures as if they were made in 2016. I didn’t find any step by step guide on how to fix this, so I’ll share the steps here.

The gist of it is that you change the original date with a date close to the GPS date/time. For some reason, Mapillary seems to consume metadata dates in this order: DateTime Original > DateTime Digitized > Modify Date > GPS Date/Time
Why the GPS date is taken last is beyond me, as I’d think that is correct by definition.

Anyway, here goes:

  1. Download exiftool
    You can download from exiftool.org, but since I was on a work PC, I used the portable version available at Oliver Betz | Artikel / ExifTool Windows installer and portable package
    Unzip the file in a folder like C:\whereever-you-like\exif tool\

  2. Open a command prompt (hit windows button and start typing “prompt”). Move the active directory by typing:

cd C:\whereever-you-like\exif tool\

(you can paste in the prompt by simply right clicking. You can access previous commands by pushing the “up” key)

  1. See if things work
    For example, let’s start the tool and use it to read the exif data from a single image:

exiftool.exe "g:\mapillary\2016\104GOPRO\G0065843.jpg"

(note: if you actually installed the exiftool, you won’t need to change the directory to the correct place and can just type exiftool, without the .exe)

Part below edited based on the tip of masterofnoroad.

  1. Try it out to fix one image
    The tool won’t just overwrite DateTimeOriginal. So first we empty it.
exiftool -DateTimeOriginal= "G:\test\testimage.jpg"
exiftool "-*Date<FileCreateDate" "G:\test\testimage.jpg"

(Make sure FileCreateDate is correct. In my test image, GPSDateTime was missing. But if you have that data, that’s probably preferred!)

Note that this comment saves a backup of the original image. If you’re satisfied with the result, we can do this in bulk.

  1. Fix everything in a single folder:
exiftool -DateTimeOriginal= "G:\mapillary\202207 ijsland deel 1"
exiftool "-*Date<FileCreateDate" "G:\mapillary\202207 ijsland deel 1"

Note: make sure to not have a \ at the end of the folder description.
If you want to do this for a folder with a bunch of subfolders, add -r
If you do this on a large folder, you’ll have a huge amount of backups to take care of. To avoid that, you can add -overwrite_original to your command.

3 Likes

Please, Mapillary devs, can you change the order as suggested?

My problem for some time is a bug in GoPro timestamp. Long story short GoPro all date and time tags are totally unreliable (like minutes value staying and only seconds change and then well into the next minute updating its value)
Only the GPSDateTime is reliable. The sequences look like this:

My resolution is to do it in two stages, as you wrote exiftool wont just overwrite DateTimeOriginal.
So first to delete it and then to write all tags with “date” in the name with value from GPSDateTime. Maybe not elegant but works for me.

exiftool -DateTimeOriginal= 103GOPRO/
exiftool “-*Date<GPSDateTime” 103GOPRO/

Thanks a lot masterofnoroad, your comment is exactly why I posted this here.

Thank you Joost! We are going to resolve this issue and treat GPS time as the source of truth rather than camera time going forward. @tao will have an update when this fix is incorporated into mapillary_tools and the desktop uploader.

A small warning on using GPS date/time:

  • GPS time isn’t local time, but UTC time or GPS time ( with some leap seconds)
  • The exif GPS date/time metadata usually doesn’t include milliseconds, but it’s possible with DateTimeOriginal + SubSecTimeOriginal tags
1 Like

I’m currently facing this issue. My GoPro Hero7 reset date to 2016 01.
For JPG files I was able to change the date with IrfanView with no problem, but I also accidently recorded few video files, how to change the date for them?
@boris Also I’ve noticed some already uploaded sequences from my friend with with year 2016, but shot not long ago. So I’m wondering wouldn’t it be possible to add some new button like “Change date of entire sequence“ and maybe allow to do that only once, so that users would not overload server with such requests?

@ursus - unfortunately we don’t have a button like that. In order to fix this you would need to change the timestamp on the video (probably just renaming it should be sufficient) and then re-upload it. After you’ve confirmed the timestamp is correct you can “Delete entire sequence” on the old incorrect one.

Thank you for reply! It’s first time I hear of sequence date taken from filename? Or “renaming” means setting video timestamp?

@ursus - ah right, I think that will not be sufficient for videos. I think as a workaround you can do the following:

  1. extract a .gpx from the GoPro video using something like exiftool (example command):
    exiftool -p /usr/local/bin/gpx.fmt -ee3 -api largefilesupport=1 “sample.mp4” > out.gpx

  2. open the .gpx in a text editor and look at the timestamps. Do a search → replace to replace the incorrect date with the correct date.

  3. upload the file together with the new .gpx in the desktop uploader (using the 3 dot overlow menu next to the video file to select the corrected .gpx file)

We’ll fix this in the future by using the GPS time in the video, but unfortunately that fix has not landed yet. cc: @tao

1 Like

@boris thank you for tips! Took me sometime to the file with incorrect date.
The “out.gpx“ produced by exiftool has correct time stamps in my case! After uploading as described on “step 3” I now see Mapillary has that sequence with wrong date (gpx timestamps are ignored).

Interesting - @ursus would you mind sharing the original video file and a link to the Mapillary sequence so we can investigate? (feel free to DM me if you don’t want to share it publicly)

@boris Thank you for quick reply! I have rechecked the videos and I believe it was my fault that I used video_2.gpx on video_1.mp4 file. But now I have another question: It looks like video_1.mp4 data and as a results video_1.gpx have corrupted gps track (I have attached files). How will Mapillary act? It will still process and use the corrupted data, right? I have car tracker and I want to try to extract gps from it and then reupload video_1.mp4 again.

@boris I think the problem I described initially still exists. Video_2 had both correct. gpx track and timestamps, but on Mapillary date is wrong. I have shared video_2.mp4 file. Here is the Mapillary sequence: