How 7-Zip Handles Pre-Compressed Formats Like JPEG and MP3

This article explains how the popular archiving tool 7-Zip interacts with already compressed media formats like JPEG and MP3. It explores why conventional compression algorithms struggle to reduce the size of these files, how 7-Zip's default LZMA and LZMA2 engines process this high-entropy data, and the recommended settings to optimize archiving speed and resource usage when dealing with multimedia files.

The Challenge of Pre-Compressed Data

Formats like JPEG (images) and MP3 (audio) have already undergone significant compression. During their initial creation, specialized algorithms remove both perceptual redundancies (lossy compression) and statistical redundancies (lossless entropy encoding, such as Huffman coding).

Because the redundant data has already been stripped away, the resulting file consists of high-entropy data that closely resembles random noise to general-purpose compression algorithms.

How 7-Zip Processes JPEG and MP3 Files

When you add JPEG or MP3 files to a .7z or .zip archive, 7-Zip treats them as generic binary data:

  • Pattern Matching Attempts: By default, 7-Zip uses the LZMA or LZMA2 algorithms. These algorithms scan for repeating sequences of bytes. Because pre-compressed files lack predictable repetitions, the algorithm finds very few matches.
  • Minimal to Zero Size Reduction: 7-Zip will typically achieve a compression ratio between 0% and 1% on these files. In some rare cases, the resulting archive may even be slightly larger than the original files due to the overhead of archive headers and metadata.
  • No Specialized Re-Compression: Unlike niche archival tools (such as Precomp or packJPG), standard 7-Zip does not unpack JPEG or MP3 structures to re-compress their internal streams. It processes the stream strictly at the container level.

The Cost of Attempting to Compress Media Files

Applying high compression levels (such as "Maximum" or "Ultra") to large collections of JPEGs or MP3s produces virtually no space savings while consuming substantial system resources:

  • High CPU and Memory Usage: The LZMA algorithm will exhaustively search its dictionary for patterns that do not exist.
  • Wasted Time: The archiving process takes significantly longer to complete compared to standard, uncompressed file types like text, raw logs, or BMP images.

When bundling collections of JPEGs, MP3s, or modern video files (such as MP4 or MKV), the most efficient approach in 7-Zip is to bypass the compression stage entirely:

  1. Set Compression Level to "Store": Change the compression level from "Normal" to "Store" (Level 0).
  2. Benefits of "Store" Mode:
    • Instant Archiving: Files are packaged as fast as your storage drive can read and write data.
    • Consolidation: You retain the organizational benefit of combining thousands of files into a single archive file.
    • Security and Utility: You can still take advantage of 7-Zip's AES-256 encryption and volume-splitting features without wasting CPU cycles trying to compress incompressible data.