Guide
Why the photos and videos in a Mastodon archive have no date, and how to put the post date back
Checked against an archive from a test Mastodon instance and a trimmed sample of a real account’s archive.
Step 1
Request your Mastodon archive
In the web interface of your server open Preferences, then Import and export, and choose Request your archive. The server prepares one file with outbox.json, actor.json and a media_attachments folder. TootRedate accepts it as .zip or .tar.gz, or as an extracted folder.
Step 2
Where the date is
Media files sit at paths like media_attachments/files/117/485/659/384/188/882/original/5ca1a84b30ea04da.png: numbered folders and a random name. In outbox.json, each post (orderedItems[].object) has a published date and an attachment list whose url ends in that same path, with the alt text in name. Matching the path gives each file its post.
Step 3
Which date is written
The date the post was published, in UTC. It is not the capture date. JPEG files get EXIF DateTimeOriginal, DateTime and OffsetTimeOriginal +00:00; MP4 files get the creation time in mvhd, tkhd and mdhd. A file that already has a date inside is left untouched. PNG, GIF, WebP and other types get the dated file name and file date only. Files no post points to go to unmatched/, unchanged.
You can do the same with ExifTool and a script of your own; TootRedate does it in the browser, free for 25 files and $9 once for all.