Find and remove duplicated motion video assets in Immich
Project description
Immich Motion Deduplicator
immich-motion-deduplicator finds MP4 motion-video duplicates created by Google Takeout style exports and removes the standalone video assets from Immich.
It is designed as a one-off CLI tool:
scanfinds photo/video pairs with the same basenameidsresolves matching Immich asset IDs through the APIdeleteremoves the matched video assets in batchesallruns the full workflow end-to-end
Why This Exists
Some exports contain both:
- a photo file such as
.jpgor.heic - a separate
.mp4file containing only the motion portion
After import, Immich can show both as separate assets. This tool helps clean up the duplicate motion videos while keeping the still image.
Requirements
- Python 3.9+
- network access to your Immich API
- an Immich API key with permission to delete assets
Install
pipx
pipx install immich-motion-deduplicator
uv
uv tool install immich-motion-deduplicator
pip
pip install immich-motion-deduplicator
From Source
git clone https://github.com/itsWavs/Immich-motion-deduplicator.git
cd Immich-motion-deduplicator
pip install .
Configuration
The app reads configuration from environment variables. If a .env file exists in the current working directory, it is loaded automatically.
Copy .env.example to .env and fill in your values:
IMMICH_ROOT_DIR=/path/to/your/immich/library
IMMICH_API_URL=http://your-immich-host:2283/api
IMMICH_API_KEY=your_api_key
MOTION_CANDIDATES_CSV=motion_candidates.csv
MOTION_CANDIDATES_WITH_IDS_CSV=motion_candidates_with_ids.csv
Notes:
IMMICH_API_URLmay include/apior omit it- CSV paths may be relative to the current working directory
- for Docker,
IMMICH_ROOT_DIRmust use the container-mounted path, not the host path
Usage
Installed command:
immich-motion-deduplicator scan
immich-motion-deduplicator ids
immich-motion-deduplicator delete
immich-motion-deduplicator all --dry-run
immich-motion-deduplicator all
Module form:
python -m immich_motion_deduplicator scan
python -m immich_motion_deduplicator ids
python -m immich_motion_deduplicator delete
python -m immich_motion_deduplicator all --dry-run
python -m immich_motion_deduplicator all
Behavior:
deleteis safe by default and only deletes when you add--executealldeletes by default so it works cleanly in automationall --dry-runpreviews the full workflow without deleting anything
Recommended flow:
immich-motion-deduplicator all --dry-run
immich-motion-deduplicator all
Docker
Docker is useful as an optional distribution path for one-off runs and automation. The repository includes a Dockerfile and docker-compose.example.yml.
Build the image:
docker build -t immich-motion-deduplicator .
Run it:
docker run --rm \
--env-file .env \
-v /path/to/your/immich/library:/library:ro \
-v "$PWD":/work \
-w /work \
immich-motion-deduplicator all --dry-run
When running in Docker, set IMMICH_ROOT_DIR=/library inside .env or pass it explicitly as an environment variable.
Development
Install the project with test dependencies:
pip install -e ".[dev]"
pytest
python -m build
Safety
- review the dry-run output before deleting
- keep backups of your library and database before bulk deletion tools
- this tool deletes Immich assets through the API and does not modify files directly on disk
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file immich_motion_deduplicator-0.1.0.tar.gz.
File metadata
- Download URL: immich_motion_deduplicator-0.1.0.tar.gz
- Upload date:
- Size: 3.7 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.9.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
00388d544c15e02c16896fa4d79ff4bd714f3da42e0e677372a4f87cad718d03
|
|
| MD5 |
9236615c924258d13c0e37946a910e5a
|
|
| BLAKE2b-256 |
1205e0dd7da7052196e22974964f0bba752fa2f017cc859a0e3f10c7cb4f9284
|
File details
Details for the file immich_motion_deduplicator-0.1.0-py3-none-any.whl.
File metadata
- Download URL: immich_motion_deduplicator-0.1.0-py3-none-any.whl
- Upload date:
- Size: 11.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.9.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
663ef97c0d8b8bf23b195af191f164887d7f9e804f763b909d3269d4d0da9602
|
|
| MD5 |
65b923be4ee7aa911e504e7d8bee40bc
|
|
| BLAKE2b-256 |
4ed9959306ba6bedffab8e386843ebe1544c0d3abbea361b67bc251903533422
|