How to use whatsapp-media-date-to-exif tool to parse image date

Hi there I see this discussion about Whatsapp images having incorrect/missing date info: https://github.com/immich-app/immich/discussions/9116. In it, someone posted a script to automatically parse the date from the file name: https://github.com/icecore2/whatsapp-media-date-to-exif My question is, on which version of the image should I run this script? Should I run it on the original images on my phone - how would I do that? Should I run it on the ${UPLOAD_LOCATION}/library folder recursively?
13 Replies
Immich
Immich•9mo ago
:wave: Hey @SkepticMystic, Thanks for reaching out to us. Please follow the recommended actions below; this will help us be more effective in our support effort and leave more time for building Immich :immich:. References - Container Logs: docker compose logs docs - Container Status: docker compose ps docs - Reverse Proxy: https://immich.app/docs/administration/reverse-proxy Checklist 1. :ballot_box_with_check: I have verified I'm on the latest release(note that mobile app releases may take some time). 2. :ballot_box_with_check: I have read applicable release notes. 3. :ballot_box_with_check: I have reviewed the FAQs for known issues. 4. :ballot_box_with_check: I have reviewed Github for known issues. 5. :ballot_box_with_check: I have tried accessing Immich via local ip (without a custom reverse proxy). 6. :blue_square: I have uploaded the relevant logs, docker compose, and .env files, making sure to use code formatting. 7. :ballot_box_with_check: I have tried an incognito window, disabled extensions, cleared mobile app cache, logged out and back in, different browsers, etc. as applicable (an item can be marked as "complete" by reacting with the appropriate number) If this ticket can be closed you can use the /close command, and re-open it later if needed.
bo0tzz
bo0tzz•9mo ago
You'd have to ask the author of the script, we don't know much about it here But in general, you shouldn't mess with the files in UPLOAD_LOCATION
SkepticMystic
SkepticMysticOP•9mo ago
Alright, thank you
Immich
Immich•9mo ago
This thread has been closed. To re-open, use the button below.
icecore
icecore•9mo ago
Hi, I wrote the script. Just updated it with refactoring code and readme.
SkepticMystic
SkepticMysticOP•9mo ago
Thank you! šŸ˜„ I'll check this out later today/this week
Mike123456
Mike123456•8mo ago
Thank you for this script! It seems to work find for images and I can see the exif data in the result, but the script itself gave the below error for every file and also Immich is not picking up the metadata... 2024-08-31 17:12:21,113 - INFO - Parsed date and time from filename: 2018:12:17 00:00:00 2024-08-31 17:12:21,113 - INFO - New exif data: {'Exif': {36867: b'2018:12:17 00:00:00 00:00:00', 36868: b'2018:12:17 00:00:00 00:00:00'}} 2024-08-31 17:12:21,121 - INFO - './processed/IMG-20181217-WA0010_1.jpg' saved successfully ℹ An error occurred: New file doesn't have exif data. Videos seem to be ignored. Any Idea how to fix it? @icecore Any idea?
icecore
icecore•8mo ago
Looks like just a log line that only mentioned that the file you processed, has no exif data. Not actual error. I'll look into it a bit later.
Mike123456
Mike123456•8mo ago
I looked at the code and it seems it is caused by a validation the is extracting the exif data after they were written to the file, which should never fail unless something went really wrong... but then the fact that immich is also not recognizing the exif data makes me think that really something is not 100% correct, but on a pic viewer in linux i can see the correct exif data so I'm wondering if there is some kind of encoding / formatting issue where that viewer is more tolerant than the lib you and immich is using to read out the data.
aviv
aviv•8mo ago
If I understand correctly it will only work for Android?
Sefi Ninio
Sefi Ninio•2mo ago
For future reference, this works well using exiftool.
exiftool -if 'not $CreateDate' -if '$filename =~ /^(?>VID|IMG)-\d{8}-WA\d{4,}\./' -r -overwrite_original_in_place -progress '-AllDates<${filename;s/WA.*//} 12:00:00' '/path/to/your/files/folder'
exiftool -if 'not $CreateDate' -if '$filename =~ /^(?>VID|IMG)-\d{8}-WA\d{4,}\./' -r -overwrite_original_in_place -progress '-AllDates<${filename;s/WA.*//} 12:00:00' '/path/to/your/files/folder'
and here are the install instructions for exiftool: https://exiftool.org/install.html#Unix
KnightElm
KnightElm•5w ago
Is it possible to run this on my existing library?
Sefi Ninio
Sefi Ninio•4w ago
You will probably have to re scan

Did you find this page helpful?