gphotos import + albums migration #1340
Replies: 37 comments 88 replies
|
A comparison for takeout helper tools: mattwilson1024/google-photos-exif:
https://github.com/TheLastGimbus/GooglePhotosTakeoutHelper v3
https://github.com/TheLastGimbus/GooglePhotosTakeoutHelper v2
https://github.com/m1rkwood/google-photos-takeout-scripts
https://github.com/laurentlbm/google-photos-takeout-date-fixer
Prior to running this script the file |
|
As I import my last remaining user, here are some notes: https://github.com/starmessage/CrcCheckCopy is useful if your user isn't very organized and has some old copies lying around for some reason, and has duplicates, but one folder is newer than the other, or some files are corrupted because they 😱 keep buying SD cards to store photos instead of moving them over to a hard drive https://github.com/mrishab/google-photos-delete-tool/blob/master/delete_photos.js is useful to delete all gphotos after you're done migrating |
|
This is a project I have not yet seen: https://github.com/gilesknap/gphotos-sync |
|
I wrote a python script that codifies steps 1-6, so you don't have to do it manually. https://github.com/MrYakobo/exif-wrapper After running it, inspect the error folders for debugging. |
|
It looks like this doesn't quite work specifically for a Pixel 7. My guess is it effects any other Pixels that do all of the image post-processing. Looking into the code of the What this means is: after uploading all of the images to immich, when trying to sync with existing files in the mobile app it will see the two files as "different". When doing a backup, it doesn't upload those files (assumingly because they have the same name), but you will see a local and remote copy of every image taken by the Pixel 7. Trying to work through how to resolve this currently |
|
Want to add on to this. So after running MrYakobo's lovely python script. (I couldn't get the docker container working, but just using the script by itself as the Dockerfile describes works great). There's a good way to optimize uploading the albums. BE CAREFUL HERE. You have to check that the python script was successful before using a script to automate uploads to make sure that you don't lose files. An easy way to do this is by running the command So it is safe to move forward if the find command looks like this: Now for the goods. #!/bin/bash
KEY="YOURKEYHERE"
SERVER="https://photos.yourdomain.com/api"
BASE_DIR="/foo/bar/Takeout/Google Photos/AlbumsProcessed"
# Change the working directory to BASE_DIR
cd "$BASE_DIR"
for album in "$BASE_DIR"/*; do
if [ -d "$album" ]; then
echo "Uploading album: $album"
immich upload \
-y \
--key "$KEY" \
--server "$SERVER" \
-d "$album" -t 16 -al
fi
doneVoila! You can skip manually uploading every album! |
|
Thanks this guide is awesome! By the way, here is a convenient way to do the albums manually when you have a lot of them. for each album
|
|
This process worked really well for me! Out of about 60,000 photos/videos, about 200 of them got upload as today's date and 15 of them (all being videos) got upload as Jan 1, 2036. That means over 59,500 photos/videos were successfully transferred from Google photos while retaining the correct dates. The 200 listed as today's date doesn't bother me too much, but the 15 listed as Jan 1, 2036 are going to be really annoying because they'll stay up at the top of the photo feed until 2036. Does anyone know how I can manually fix their dates? Should I just download them, delete them from Immich, use some tool to modify their created date, then re-upload? Btw I used the docker version of the Immich CLI when importing. |
|
google-photos-exif didn't quite do the job for me, so I wrote my own little tool google-photos-migrate, but use at your own risk |
|
For those who are lazy, I used some Python snippets that others can use in A little setup: import os
import subprocessingStep 4
takeout = "/mnt/f/user google takeout/takeout"
albums = next(os.walk(os.path.join(takeout, "Albums/")))[1]
for album in albums:
subprocess.run(["yarn", "start", "--inputDir", os.path.join(takeout, "Albums/", album), "--outputDir", os.path.join(takeout, "AlbumsProcessed/", album), "--errorDir", os.path.join(takeout, "AlbumsError/", album)])Step 7
takeout = "/mnt/f/user google takeout/takeout"
albums = next(os.walk(os.path.join(takeout, "AlbumsProcessed/")))[1]
key = "APIKEY"
server = "https://immich.domain.tld/api"
for album in albums:
subprocess.run(["immich", "upload", "--yes", "--key", key, "--server", server, "-t", "16", "-al", "--recursive", os.path.join(takeout, "AlbumsProcessed/", album)]) |
|
Here's @lukehmcc's #1340 (comment) script for those using Docker that creates the albums and then uploads the photos |
|
This script is currently broken, working on fixing it. When this command is run it prompts the user for the API address, API key, base dir (where the takeout zips are), and docker dir (a directory that can safely run docker containers via compose, as you cannot do this on cifs mounts). Once those values are input it unzips, cleans metadata, and automatically uploads all albums and photos. Here is the repo(lukehmcc/simple-gphotos-immich-migration). The script really is quite simple, just a combination of a lot of work that's been done here so far. It utilizes a forked version of MrYakobo/exif-wrapper which utilizes the new and improved https://github.com/garzj/google-photos-migrate over mattwilson1024/google-photos-exif. Lmk where you guys would like to bring this next. Could this be something that could be implemented into immich directly? If so how do you guys envision that? |
|
When you download the albums, do you do this manually by going to google photos and clicking |
|
I must be stupid. I'm trying to do step 4 and I just get this output: I'm running the command in the google-photos-exif cloned repo directory. Solution: I had to install |
|
On step 4 I get this response even though there are json files that correspond to each media file and a Edit: I uploaded the album to the server just to test if everything had the correct date and it did. Not sure why but I'll take it. |
|
Any idea why some of my Google Photos didn't come with json files and don't have a DateTimeOriginal field but show up with the correct data on Google Photos? Should I request another takeout? |
|
Hi, I have discovered this discussion a bit late... Anyway, I wrote a tool to import google photos takeout files with albums when present, directly from the zipped files. It handles albums, handles duplicates, discard field videos, and many other options. No manual work is required. Easy installation Details here: https://github.com/simulot/immich-go#readme Reading this discussion, I have checked the timeline and the map. Sure enough, I have some pictured taken on 2036, and some others located in the gulf of Guinea. |
|
It seems like the problem space of taking care of Takeout.zip was bigger than anybody thought; that's why we now have a million different repos (including my shitty one) that promise to import your Google Photos into immich. Maybe we should make a wiki page and populate it with all possible invariants. The situation right now is confusing for everybody I think... 👍 |
done |
|
This doesn't appear to work on live video which I have taken. There are tools which are capable of merging the videos into the photos to create a live photo, but this seems an unnecessarily complex solution. |
|
I've successfully ran the google-photos-migrate tool on 1.16tb of google takeout photos (took 10hrs on my underpowered NAS but made it through). Can anyone help me understand the folder structure after everything is complete? Both AlbumsProcessed and PhotosProcessed seem to be close to the same size (~500gb a piece). Are these after deduplication scan? Do both directories have the same photos in them but is the photos directory just a flat directory and the albums directory has the same content but in their original directories? Id love to see a results.json file that lists all the stats once completed that explains things a bit. I need to know what directory i need to upload to immich and i dont want to do another dedupe scan. Any help would be great. |
|
I prefer to keep the original quality/format of my photos/videos and not degrade to the reduced Google Photos upload/download quality. So I would like to apply the Google Albums metadata to recover those albums in my Immich originals. |
|
Hi, Be aware of the \ at the end of each path. |
|
The entire discussion above focusses on date taken, but do any of the scripts also take care of migrating face data? Did quite some work on tagging all of my 150K photos with relevant gps and face recognition data and would not like to see it getting lost... |
|
Hopefully this is useful - I used the command line in the posts from this forum thread (exiftool) to fix mine: https://exiftool.org/forum/index.php?topic=12602.0 and this https://exiftool.org/forum/index.php?topic=11064.45 This updated the original files instead of creating copies. |
|
I currently use gphotos-cdp through a container image I packaged with a script that by default adds the specific custom logic I need. |
|
url at first topic is not working |






Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
gphotos import + albums
With this guide, you
STILL have to add images that are in multiple albums manually (except for the first instance of that image, so hopefully this isn’t too many)can get albums imported now as of https://github.com/immich-app/CLI/pull/49prereqs:
mattwilson1024/google-photos-exif,exiftool,ffmpegInstructions
download:
extract:
note: your files that are in albums will be duplicated, but immich will handle the deduplication and not upload it twice
create directory structure to:
run
mattwilson1024/google-photos-exifon EACH album to add missing EXIF data:run
mattwilson1024/google-photos-exifonGooglePhotosto add missing EXIF data:if any have errored out in
AlbumsProcessedorerror, fix metadata by running:exiftool -all= -tagsfromfile @ -all:all -unsafe -icc_profile .then run
mattwilson1024/google-photos-exifagain on the (fixed) error directory (2nd pass), they should all pass now. move all output files to their corresponding output foldersupload ALBUMS to immich FIRST
so media gets put into albums (otherwise it will not be put inside their respective albums and you’ll have to manually select each photo manually to add to the album, and you can’t re-upload it because of deduplication which rejects files with the same hash)Edit: I prefer doing it this way, but this no longer /has/ to be done first as the CLI will still associate images with albums if they are in the folder structure.Upload each album INDIVIDUALLY and VERIFY file counts. If there are any discrepancies, figure out why. For example, if a file is not supported, some files are missing their corresponding
jsonfiles so metadata was not added, or the file is a duplicate. If there were any errors, rerunmattwilson1024/google-photos-exifon them using the commands above.for unsupported files, you can convert the format using:
ffmpeg -i example.MPG example.mp4orffmpeg -i filename.mov -c copy filename.mp4for missing json files, you can find the nearest neighbor, such as
longfilename.(1).jpnote the missing “g” injp(as opposed tojpg)you can compare whether images have the same hash with:
sha1sum file.extor find duplicates with https://github.com/qarmin/czkawkafor duplicate files in multiple albums, add the corresponding missing images back to their albums.
Once all albums have been processed and verified, upload the rest that are not in albums:
immich upload \ --key APIKEY \ --server https://immich.domain.tld/api \ -d '/mnt/f/user google takeout/Takeout/output' -t 16Verify you don’t have any files that show up as current day upon refreshing immich. Repeat any of the above steps if they are showing up without proper metadata.
Rejoice as you are now free from gphotos.
All reactions