Skip to main content

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:

  • scan finds photo/video pairs with the same basename
  • ids resolves matching Immich asset IDs through the API
  • delete removes the matched video assets in batches
  • all runs the full workflow end-to-end

Why This Exists

Some exports contain both:

  • a photo file such as .jpg or .heic
  • a separate .mp4 file 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_URL may include /api or omit it
  • CSV paths may be relative to the current working directory
  • for Docker, IMMICH_ROOT_DIR must 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:

  • delete is safe by default and only deletes when you add --execute
  • all deletes by default so it works cleanly in automation
  • all --dry-run previews 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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

immich_motion_deduplicator-0.1.0.tar.gz (3.7 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

immich_motion_deduplicator-0.1.0-py3-none-any.whl (11.1 kB view details)

Uploaded Python 3

File details

Details for the file immich_motion_deduplicator-0.1.0.tar.gz.

File metadata

File hashes

Hashes for immich_motion_deduplicator-0.1.0.tar.gz
Algorithm Hash digest
SHA256 00388d544c15e02c16896fa4d79ff4bd714f3da42e0e677372a4f87cad718d03
MD5 9236615c924258d13c0e37946a910e5a
BLAKE2b-256 1205e0dd7da7052196e22974964f0bba752fa2f017cc859a0e3f10c7cb4f9284

See more details on using hashes here.

File details

Details for the file immich_motion_deduplicator-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for immich_motion_deduplicator-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 663ef97c0d8b8bf23b195af191f164887d7f9e804f763b909d3269d4d0da9602
MD5 65b923be4ee7aa911e504e7d8bee40bc
BLAKE2b-256 4ed9959306ba6bedffab8e386843ebe1544c0d3abbea361b67bc251903533422

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page