Skip to main content

PyECM Tools

PyPI Version License: MIT Python Versions

A high-performance Python wrapper for Neill Corlett's classic ECM (Error Code Modeler) tools, designed for compressing and decompressing PlayStation (PSX) and other CD-based disc images.

What is ECM and Why Use It for PSX Games?

PlayStation disc images (usually in .bin/.cue format) are large. While you can compress them with standard tools like .zip or .7z, the results are often not as good as they could be.

This is because CD-ROM data includes Error Detection Code (EDC) and Error Correction Code (ECC). This data is mathematically generated and behaves much like random noise, which is notoriously difficult to compress.

The ECM tool works by stripping out this redundant ECC/EDC data from the disc image. The resulting .ecm file is much smaller and contains more uniform data, which can then be compressed extremely well by other tools like 7-Zip or RAR.

When you need to use the image again, the unecm process perfectly regenerates the original ECC/EDC data, restoring the file to its original, bit-perfect state.

This package makes that powerful C code available with a simple, Pythonic interface.

Features

  • Faithful Wrapper: Uses the original, battle-tested C source code from Neill Corlett for 100% compatibility.
  • High Performance: All heavy lifting is done in compiled C code, offering native speed for encoding and decoding.
  • Simple Pythonic API: Provides easy-to-use encode() and decode() functions.
  • Progress Reporting: Includes a callback mechanism to easily track the progress of long operations, perfect for GUIs or logging.
  • Cross-Platform: Compiles on Windows, macOS, and Linux.

Installation

You can install the package directly from PyPI using uv or pip:

uv pip install pyecm-tools

Quick Start: Compressing Civilization II

Let's say you have a disc image of Civilization II for the PlayStation and you want to archive it efficiently.

import pyecm
import os

# --- Define our file paths ---
input_file = "Civilization II (USA).bin"
ecm_file = "Civilization II (USA).ecm"
restored_file = "Civilization II (USA).restored.bin"

# --- Create a dummy file for the example if it doesn't exist ---
if not os.path.exists(input_file):
    print(f"Creating a dummy file for '{input_file}'...")
    with open(input_file, "wb") as f:
        # A typical PSX game is ~650MB. We'll make a smaller 50MB file.
        f.write(os.urandom(50 * 1024 * 1024))

# 1. Encode the .bin file to .ecm
print(f"Encoding '{input_file}' to '{ecm_file}'...")
try:
    pyecm.encode(input_file, ecm_file)
    print("Encoding successful!")
except Exception as e:
    print(f"An error occurred: {e}")

# 2. Decode the .ecm file back to a .bin
print(f"\nDecoding '{ecm_file}' to '{restored_file}'...")
try:
    pyecm.decode(ecm_file, restored_file)
    print("Decoding successful!")
except Exception as e:
    print(f"An error occurred: {e}")

# You can now verify that 'input_file' and 'restored_file' are identical.
# For even better compression, you can now compress the .ecm file with 7-Zip.

Advanced Usage: Progress Reporting

For large files, you'll want to see the progress. You can pass any Python function as a callback to the progress argument.

import pyecm

def my_progress_reporter(current_bytes, total_bytes, operation_type):
    """A callback function to display progress."""
    if total_bytes == 0:
        percent = 100
    else:
        percent = (current_bytes * 100) / total_bytes

    # The 'type' argument is 0 for the initial analysis phase and 1 for processing
    stage = "Analyzing" if operation_type == 0 else "Processing"

    print(f"\r{stage}: {percent:.2f}% complete ({current_bytes}/{total_bytes})", end="")
    if current_bytes == total_bytes:
        print() # Newline at the end

# --- Use the callback with encode ---
print("Encoding with progress reporting:")
pyecm.encode(
    "Civilization II (USA).bin",
    "Civilization II (USA).ecm",
    progress=my_progress_reporter
)

# --- Use the callback with decode ---
print("\nDecoding with progress reporting:")
pyecm.decode(
    "Civilization II (USA).ecm",
    "Civilization II (USA).restored.bin",
    progress=my_progress_reporter
)

License

This Python wrapper (pyecm-tools) is distributed under the MIT License.

The original C code for ECM and UNECM is copyrighted by Neill Corlett and is distributed under the GNU General Public License v2 (GPLv2). The source code is included in this package.

Acknowledgements

  • All credit for the brilliant ECM algorithm and its implementation goes to Neill Corlett.

Metadata

Release files for pyecm-tools 1.0.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pyecm-tools 1.0.2
File Size Uploaded
pyecm_tools-1.0.2.tar.gz 10.8 kB Details

Built distributions (wheels)

Table of built distributions (wheels) for pyecm-tools 1.0.2
File
pyecm_tools-1.0.2-cp314-cp314t-musllinux_1_2_x86_64.whl CPython 3.14 CPython 3.14 free-threading Linux musl 1.2+ x86-64 Details
pyecm_tools-1.0.2-cp314-cp314t-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl CPython 3.14 CPython 3.14 free-threading Linux glibc 2.28+ x86-64, Linux glibc 2.17+ x86-64 Details
pyecm_tools-1.0.2-cp314-cp314-musllinux_1_2_x86_64.whl CPython 3.14 CPython 3.14 Linux musl 1.2+ x86-64 Details
pyecm_tools-1.0.2-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl CPython 3.14 CPython 3.14 Linux glibc 2.17+ x86-64, Linux glibc 2.28+ x86-64 Details
pyecm_tools-1.0.2-cp313-cp313-musllinux_1_2_x86_64.whl CPython 3.13 CPython 3.13 Linux musl 1.2+ x86-64 Details
pyecm_tools-1.0.2-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl CPython 3.13 CPython 3.13 Linux glibc 2.17+ x86-64, Linux glibc 2.28+ x86-64 Details
pyecm_tools-1.0.2-cp312-cp312-musllinux_1_2_x86_64.whl CPython 3.12 CPython 3.12 Linux musl 1.2+ x86-64 Details
pyecm_tools-1.0.2-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl CPython 3.12 CPython 3.12 Linux glibc 2.28+ x86-64, Linux glibc 2.17+ x86-64 Details
pyecm_tools-1.0.2-cp311-cp311-musllinux_1_2_x86_64.whl CPython 3.11 CPython 3.11 Linux musl 1.2+ x86-64 Details
pyecm_tools-1.0.2-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl CPython 3.11 CPython 3.11 Linux glibc 2.17+ x86-64, Linux glibc 2.28+ x86-64 Details
pyecm_tools-1.0.2-cp310-cp310-musllinux_1_2_x86_64.whl CPython 3.10 CPython 3.10 Linux musl 1.2+ x86-64 Details
pyecm_tools-1.0.2-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl CPython 3.10 CPython 3.10 Linux glibc 2.17+ x86-64, Linux glibc 2.28+ x86-64 Details
pyecm_tools-1.0.2-cp39-cp39-musllinux_1_2_x86_64.whl CPython 3.9 CPython 3.9 Linux musl 1.2+ x86-64 Details
pyecm_tools-1.0.2-cp39-cp39-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl CPython 3.9 CPython 3.9 Linux glibc 2.17+ x86-64, Linux glibc 2.28+ x86-64 Details
pyecm_tools-1.0.2-cp38-cp38-musllinux_1_2_x86_64.whl CPython 3.8 CPython 3.8 Linux musl 1.2+ x86-64 Details
pyecm_tools-1.0.2-cp38-cp38-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl CPython 3.8 CPython 3.8 Linux glibc 2.17+ x86-64, Linux glibc 2.28+ x86-64 Details

Total release size: 3.1 MB

Release files / pyecm_tools-1.0.2.tar.gz

Download URL pyecm_tools-1.0.2.tar.gz
Size 10.8 kB
Tags Source
SHA-256 checksum
How to use checksums
c7df3c816a710c52a7101a9bdaf60bb6579de7058d703bbcb81b27af7a10e3e7
BLAKE2b-256 checksum
How to use checksums
9ee34ad10012bb4e79792cea069deddd454709e63b7bf3f2ecd1d677cdb345e0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.7

Release files / pyecm_tools-1.0.2-cp314-cp314t-musllinux_1_2_x86_64.whl

Download URL pyecm_tools-1.0.2-cp314-cp314t-musllinux_1_2_x86_64.whl
Size 231.9 kB
Tags CPython 3.14 CPython 3.14 free-threading Linux musl 1.2+ x86-64
SHA-256 checksum
How to use checksums
992d2279844f1b6c21b662d7cc04f4b15c2f7d59295b2dd2b5a12ad5c4beab70
BLAKE2b-256 checksum
How to use checksums
ce3094baa6c3394a9a6e1a0d3c39f7f2735df5a5ed1dde346c246488299b4fe0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.7

Release files / pyecm_tools-1.0.2-cp314-cp314t-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl

Download URL pyecm_tools-1.0.2-cp314-cp314t-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Size 237.3 kB
Tags CPython 3.14 CPython 3.14 free-threading Linux glibc 2.17+ x86-64 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
a6b3d29030eb05d99f5d117ea2cad60cd206a261e865ee743429cf24e0a8a49a
BLAKE2b-256 checksum
How to use checksums
6877cebec2a7c016c567588b38e5a622654bab2fe85738b29bb013e77f96179c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.7

Release files / pyecm_tools-1.0.2-cp314-cp314-musllinux_1_2_x86_64.whl

Download URL pyecm_tools-1.0.2-cp314-cp314-musllinux_1_2_x86_64.whl
Size 194.2 kB
Tags CPython 3.14 Linux musl 1.2+ x86-64
SHA-256 checksum
How to use checksums
d465f60f201dd3ad37c8a652a350509ead58aee889b269f4fb532c179f144130
BLAKE2b-256 checksum
How to use checksums
a18af18418180e23121846a279a08082967ff38c2aac4e768a388566fc60a626
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.7

Release files / pyecm_tools-1.0.2-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl

Download URL pyecm_tools-1.0.2-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Size 201.1 kB
Tags CPython 3.14 Linux glibc 2.17+ x86-64 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
e905e5715699a22d30f6bcca864207779cca8a8dfda545cc71829610cd463a0d
BLAKE2b-256 checksum
How to use checksums
9125b5b9344465910471c09083e111abfd745b513b0919ea36453428b5bfb85c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.7

Release files / pyecm_tools-1.0.2-cp313-cp313-musllinux_1_2_x86_64.whl

Download URL pyecm_tools-1.0.2-cp313-cp313-musllinux_1_2_x86_64.whl
Size 196.1 kB
Tags CPython 3.13 Linux musl 1.2+ x86-64
SHA-256 checksum
How to use checksums
17fcbc63eb554f33b12e6b684464af8f5278635956fa647094871d7f8ef051d3
BLAKE2b-256 checksum
How to use checksums
4938bcccdf0edf99d96f3ba1a42e12e244f46f76ba7221e220988b1eed5e8e01
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.7

Release files / pyecm_tools-1.0.2-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl

Download URL pyecm_tools-1.0.2-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Size 202.9 kB
Tags CPython 3.13 Linux glibc 2.17+ x86-64 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
8d470672d3c5aa978ec0ee3a1d150ee125db7f6cd2c621bcfc7a744ef5920d2b
BLAKE2b-256 checksum
How to use checksums
21f31e25a0f42c5622f7bf39c17d7fa16e7194f4de0b61a2a698ca3fdae1c26b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.7

Release files / pyecm_tools-1.0.2-cp312-cp312-musllinux_1_2_x86_64.whl

Download URL pyecm_tools-1.0.2-cp312-cp312-musllinux_1_2_x86_64.whl
Size 201.9 kB
Tags CPython 3.12 Linux musl 1.2+ x86-64
SHA-256 checksum
How to use checksums
dca03c1c8e82c0a7feb858496d4c17e3172b290358f00ba4682da90eb745a32c
BLAKE2b-256 checksum
How to use checksums
5387817f89a3d5abd2558a1c3d065cc7667d5c5f65e4894d3d1f5c5165681453
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.7

Release files / pyecm_tools-1.0.2-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl

Download URL pyecm_tools-1.0.2-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Size 206.5 kB
Tags CPython 3.12 Linux glibc 2.17+ x86-64 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
56bb436368a0460fb39c5fa86e822f492312bee8fdb5cfab1b699957198cde74
BLAKE2b-256 checksum
How to use checksums
95a4b88dbd810f1946215bafe41e415fd797728396791b2b65d6241da7e9f503
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.7

Release files / pyecm_tools-1.0.2-cp311-cp311-musllinux_1_2_x86_64.whl

Download URL pyecm_tools-1.0.2-cp311-cp311-musllinux_1_2_x86_64.whl
Size 180.5 kB
Tags CPython 3.11 Linux musl 1.2+ x86-64
SHA-256 checksum
How to use checksums
97b3d248b3bfe8d0bf450acfbcdc4f333d4a26cf164c5286cec5c7cf75d631a8
BLAKE2b-256 checksum
How to use checksums
ff3a42565815b743250c7c481da190942f797f8bc5a915273d5fb0ac69536f2a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.7

Release files / pyecm_tools-1.0.2-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl

Download URL pyecm_tools-1.0.2-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Size 191.2 kB
Tags CPython 3.11 Linux glibc 2.17+ x86-64 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
2fe15a43767f49e0d5d03185531487309fcc93d8151d5929e3b3bcfc680625d6
BLAKE2b-256 checksum
How to use checksums
ce53676c72fe59a78acec0f30237d279a8592bb940e74d3a22b328e43e5f0847
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.7

Release files / pyecm_tools-1.0.2-cp310-cp310-musllinux_1_2_x86_64.whl

Download URL pyecm_tools-1.0.2-cp310-cp310-musllinux_1_2_x86_64.whl
Size 176.4 kB
Tags CPython 3.10 Linux musl 1.2+ x86-64
SHA-256 checksum
How to use checksums
289d0ef2aeee59f869de7a0ecda59f7c18014a2d23e085dd211a3ca93476fa55
BLAKE2b-256 checksum
How to use checksums
6d9346d68afd0da4231123c70598b621ce96a2c11f8b2d898a0c753e287f8c3d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.7

Release files / pyecm_tools-1.0.2-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl

Download URL pyecm_tools-1.0.2-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Size 180.6 kB
Tags CPython 3.10 Linux glibc 2.17+ x86-64 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
ac646c64f90cdec7e3843ec634c58815ac369ab2f3ed5c133151c705b2db993e
BLAKE2b-256 checksum
How to use checksums
eb4c9a58bb536e2284b52ea08fdb2ee9ebb17bfd32b0e9dcd6b544aa2c710138
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.7

Release files / pyecm_tools-1.0.2-cp39-cp39-musllinux_1_2_x86_64.whl

Download URL pyecm_tools-1.0.2-cp39-cp39-musllinux_1_2_x86_64.whl
Size 175.7 kB
Tags CPython 3.9 Linux musl 1.2+ x86-64
SHA-256 checksum
How to use checksums
c9fcfee57526497dc72179376630c052e72eb6e0573ea3019981c51ba24fd526
BLAKE2b-256 checksum
How to use checksums
ab3625727bec8137aca109b9c222fb631f5bc3fe5eeea26c13535452f44e09b3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.7

Release files / pyecm_tools-1.0.2-cp39-cp39-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl

Download URL pyecm_tools-1.0.2-cp39-cp39-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Size 179.9 kB
Tags CPython 3.9 Linux glibc 2.17+ x86-64 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
101c205d3bcf4b6c84b228109f73b4e1881defe2b390aeb1061550fd3fe616e7
BLAKE2b-256 checksum
How to use checksums
ab2b98dd8f36f30d555f454d5aa2b566a58fedb2efaffd3443253a8556ea0553
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.7

Release files / pyecm_tools-1.0.2-cp38-cp38-musllinux_1_2_x86_64.whl

Download URL pyecm_tools-1.0.2-cp38-cp38-musllinux_1_2_x86_64.whl
Size 158.0 kB
Tags CPython 3.8 Linux musl 1.2+ x86-64
SHA-256 checksum
How to use checksums
5eaaa7b1a7eeed68a237294274e2830f60ece374d9d88f59826f75f56e870770
BLAKE2b-256 checksum
How to use checksums
2c34fd6605a5a67cc2283cf4fe021bc7656d7346aa640cc792497af33d0b1f66
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.7

Release files / pyecm_tools-1.0.2-cp38-cp38-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl

Download URL pyecm_tools-1.0.2-cp38-cp38-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Size 163.3 kB
Tags CPython 3.8 Linux glibc 2.17+ x86-64 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
44053867d2b97017e36802e28d513e97a2a705231aac54bfd95253a2097cdc01
BLAKE2b-256 checksum
How to use checksums
71b053de4cb0cacc7d0325d76ed3b91a02c65a3a4c19f7c9e1e278c5d4fda016
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.7

Release history Release notifications | RSS feed

This release

1.0.2 This release

17 release files

1.0.1

17 release files

1.0.0

17 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page