Jump to content

Data Compression/Executable Compression/ECM file on Linux

From Wikibooks, open books for an open world

How to compress or decompress an ECM file on GNU/Linux?

Description

[edit | edit source]

The ECM format allows you to reduce the size of a typical CD image file (ISO, BIN, CDI, NRG, CCD, or any other format that uses raw sectors). It works by eliminating the Error Correction/Detection Codes (ECC/EDC) from each sector whenever possible. The encoder automatically adjusts to different sector types and automatically skips any headers it encounters. Since the data skipped is nearly impossible to compress with traditional tools, the resulting ECM file will compress far better than the raw CD image.

ECM on Linux

[edit | edit source]

Install the "ecm" package, it is available in Debian repositories:

https://packages.debian.org/stretch/ecm

apt install "ecm"

Compress

[edit | edit source]

use "ecm-compress" command

EXAMPLES

      ecm-compress foo.bin
strips  the  ECC/EDC  data  from  the  foo.bin CD image and save the resulting file as foo.bin.ecm
      ecm-compress foo.img foobar
strips the ECC/EDC data from the foo.img  CD  image  and  save the resulting file as foobar

run "man ecm-compress" for more information

De-compress

[edit | edit source]

use "ecm-uncompress" command

EXAMPLES

      ecm-uncompress foo.bin.ecm
regenerate the ECC/EDC data from foo.bin.ecm and save the resulting CD image as foo.bin
      ecm-uncompress foo.img.ecm foobar
regenerate the ECC/EDC data from foo.img.ecm and save the resulting CD image as foobar

run "man ecm-uncompress" for more information

Sources

[edit | edit source]