|
Armin Walland
96d7263abe
Rename all image references to media for consistency
- Rename get_base_image_path() to get_base_media_path() - Rename test_get_base_image_path() to test_get_base_media_path() - Update all variable names from *_image to *_media in tests - Update summary output from "Images updated" to "Media files updated" - Update all comments and assertions to use "media file" instead of "image" This improves code clarity since the tool handles both images and videos. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com> |
||
|---|---|---|
| .idea | initial commit | |
| src | Rename all image references to media for consistency | |
| test | initial commit | |
| .gitignore | initial commit | |
| Cargo.lock | initial commit | |
| Cargo.toml | Implement complete Google Takeout EXIF updater with parallel processing | |
| CLAUDE.md | Add comprehensive video file support | |
| LICENSE | Implement complete Google Takeout EXIF updater with parallel processing | |
| README.md | Update README.md | |
gtakeout
A command-line utility for processing Google Takeout photo and video metadata and updating EXIF timestamps.
Overview
When you export your photos and videos from Google Photos using Google Takeout, you receive .supplemental-metadata.json files alongside your media files. These JSON files contain metadata including the original photo/video taken time. This tool automatically updates the EXIF/metadata of images and videos that lack timestamps using the information from these metadata files.
Features
- Recursively searches directories for Google Takeout metadata files
- Supports both images and videos (JPG, PNG, MP4, MOV, AVI, MKV, M4V, 3GP, WebM, FLV, WMV)
- Parallel processing across all CPU cores for maximum performance
- Extracts photo/video timestamps from JSON metadata
- Checks existing EXIF/metadata to avoid overwriting
- Updates EXIF DateTimeOriginal, DateTime, and CreateDate fields
- For videos, also updates MediaCreateDate, TrackCreateDate, and related QuickTime tags
- Provides summary statistics after processing
Prerequisites
- Rust toolchain (for building)
- exiftool must be installed on your system
Installing exiftool
Linux (Debian/Ubuntu):
sudo apt install libimage-exiftool-perl
Linux (Fedora/RHEL):
sudo dnf install perl-Image-ExifTool
macOS:
brew install exiftool
Other systems: Download from exiftool.org
Installation
cargo build --release
The binary will be available at target/release/gtakeout
Usage
gtakeout <DIRECTORY>
Where <DIRECTORY> is the path to your Google Takeout export folder.
Example
# Process all photos in the Takeout directory
gtakeout ~/Downloads/Takeout
# Process a specific album
gtakeout ~/Downloads/Takeout/Google\ Photos/My\ Album
Output
The tool will:
- Display which files are being updated
- Skip files that already have EXIF dates
- Report any errors encountered
- Show a summary of operations performed
Example output:
Searching for supplemental metadata files in: test
Updated: test/IMG-20161219-WA0000.jpg
Skipped (already has EXIF date): test/IMG-20200101-WA0001.jpg
Summary:
Metadata files found: 2
Images updated: 1
Errors: 0
How It Works
- Scans directory recursively for
*.supplemental-metadata.jsonfiles - Collects all matching files into a list
- Processes all files in parallel using all available CPU cores
- For each metadata file, determines the corresponding image/video filename
- Detects file type (image or video) and checks for existing date metadata:
- For images: Uses fast native EXIF reader
- For videos: Uses exiftool to check QuickTime/MP4 date tags
- If no date exists, extracts
photoTakenTime.timestampfrom JSON - Converts Unix timestamp to EXIF datetime format (YYYY:MM:DD HH:MM:SS)
- Uses exiftool to write the timestamp with appropriate tags:
- For images: DateTimeOriginal, DateTime, CreateDate
- For videos: Also sets MediaCreateDate, MediaModifyDate, TrackCreateDate, TrackModifyDate
Performance
The application uses Rayon for parallel processing, which automatically distributes the workload across all available CPU cores. This provides significant performance improvements when processing large Google Takeout exports:
- On a quad-core system, expect up to 3-4x speedup compared to sequential processing
- On an 8-core system, expect up to 6-8x speedup
- Actual speedup depends on I/O performance and the speed of exiftool operations
Safety
- Original files are modified directly (exiftool uses
-overwrite_originalflag) - Only images without existing EXIF dates are modified
- Make a backup of your photos before running if you're concerned
License
This project is licensed under the WTFPL (Do What The Fuck You Want To Public License) - see the LICENSE file for details.
In short: You just DO WHAT THE FUCK YOU WANT TO.