[HOWTO] Transfer pictures from Google Photos to /e/ Cloud

Goal
Use /e/ Cloud to store pictures and videos instead of Google Photos.

Disclaimer

  • I’ll give you some script to transfer your data easily from Google Photos to /e/ Cloud. There is an option to delete data as well, in order to avoid filling up your computer storage. Using it may result in data loss. Do it at your own risk.
  • Also, this isn’t some out-of-the-box script that does everything for you, yet. It only works on unix systems (but you can try executing it from Windows Subsystem for Linux, it should work), as I only began working on it this afternoon.
  • To developers: you are free to copy, modify, and redistribute it as you wish (as long as you never sell it… Well, actually, there is nothing to sell, so…)!

Pre-requisites

  • Go to Google Takeout and download your data from Google Photos (actually, you should download all of your data, as the script can find any picture in any folder recursively). It will take some time. Like days, or weeks. It took about a week for my more or less 70 Go of data.
  • Since Google doesn’t like you getting back your data, it will give you a lot of ZIPs to download with your data scattered in them. Unzip them all in a clean folder. ZIP tools usually know how to get back original folder structure, even from multiple ZIPs.
  • Download and install NodeJS
  • Download my send-medias-to-nextcloud.js script and put it in the Google Photos folder (or any folder of which you want to transfer the pictures and videos to your Nextcloud folder)
  • Optional: if you want to convert your video files as described in the step 1 of the guide, install ffmpeg (it should be installed if you have VLC on your computer)

Guide

  1. Convert your videos: the mp4 format is known by almost every video player so it was my choice when I did it. But if you don’t want to, modify my script to make it accept all the video format you want (fileExtensionList variable). You can get all the file extensions existing under your Google Photos folder by executing the following command:
    find . -type f -name '*.*' | sed 's|.*\.||' | sort -u
    For example, to convert your mov to mp4, execute the following command:
    find . -wholename "**/*".mov -exec ffmpeg -i {} {}.mp4 \;
    If you want to erase the original file after converting it, add a space then -exec rm {} \; at the end of this previous line.
    Repeat this process by replacing mov in the previous command line for every video file extension you want to convert to mp4.
  2. If you have pictures that haven’t a jpg, jpeg or png file extension (case insensitive), open the script, add the missing extensions in the fileExtensionList variable, save the script and close it.
  3. Execute the script with node send-medias-to-nextcloud.js <path to your Nextcloud folder>. If you want to remove each file that you have transfered after having copied it (because you don’t have enough space on your computer, for example), add a space and then --remove=true at the end of the previous command line
  4. Enjoy your photos and videos on Nextcloud!

Troubleshooting

  • There is a lot of parameters applicable to ffmpeg to have the best result possible after converting videos. I don’t know them, but if you care, you should take a look at a better way to convert your files!
  • Feel free to tell me what issue you are facing by replying to this post, and I will try to help you!

Thanks,
Fluf

4 Likes

Warning
Please note that if you have a lot of photos/videos, and that you have the Nextcloud app installed on your phone, it will try to sync the folders on the device. I deleted the app before doing the sync to avoid that, having roughly 70Gb of data that I don’t want on my device, but only on my /e/ Cloud. If you don’t delete the app, know that deleting synced files and folders on your phone will delete them on your /e/ Cloud too.