decryptune
Fast, native M4A (fMP4/CENC) decryptor + MP4 sanitizer + iTunes tagger in one lightweight, self-contained call — a Rust core with a sync/async Python API that replaces the usual chain of external tools (no subprocesses, no ffmpeg, no dependencies) and runs fully GIL-free, so async callers can fan out without blocking the event loop.
Install
pip install decryptune
From source (needs Rust 1.85+ and Python 3.12+): pip install maturin && maturin build --release — this is also the macOS path (it builds and runs the same; prebuilt wheels ship for Linux and Windows).
Usage
from decryptune import DecrypTune, TuneMeta
sp = DecrypTune()
sp.proc(
input="track.m4a", # bytes / bytearray / memoryview / path
out="out.m4a", # destination path; None → the processed bytes are returned
key="<32 hex>", # None → fix-only pass (headers sanitized, payload untouched)
kid="<32 hex>", # verified against the file's tenc; ignored without key
meta=TuneMeta(
title="Song",
artists=["A"],
isrc="...",
cover="cover.jpg", # bytes or path — JPEG/PNG; oversized JPEGs shrink to ≤1000px
# date=..., album=..., genre=..., lyrics=..., composer=...,
# track=..., track_total=..., disc=..., disc_total=...
),
strict=True # raise (code 8, per-fragment chi² evidence) when a fragment
) # decrypts to statistical noise — a wrong/fake key
# async twin — same options, same result:
out_bytes = await sp.aproc(...)
Rules that hold for both proc and aproc:
- Every parameter is keyword-only.
outis a path → the file is written atomically (tmp + rename) andNoneis returned;outisNone→ the processedbytesare returned.key=None→ fix-only pass: headers sanitized, audio payload untouched.- A
metawipes the existing tag block and rebuilds it solely from the given fields —None/0/ empty values are skipped; withoutmetathe original metadata passes through untouched. - Any problem raises
DecrypTuneErrorwith a stable numeric code (1–13) and a message authored in the native core:1invalid key ·2invalid kid ·3input not found ·4not an MP4 ·6write failed ·7KID mismatch ·8corrupt audio detected ·9bad input type ·10bad out type ·11tags need a fragmented file ·12bad cover ·13cover file not found.
Benchmark
Native Windows 11 (windows-x86_64 wheel), Intel i7-11800H (8C/16T), Python 3.13, real 3.0MB fragmented track:
| scenario | result |
|---|---|
| decrypt + fix, strict (bytes in/out) | 3.0 ms median — ~1.0 GB/s |
| fix-only pass (no key) | 1.0 ms |
| full tags + cover resize (877KB JPEG) | 219 ms |
32 calls: sequential → asyncio.gather (bytes) |
97 ms → 30 ms (×3.3) |
| 32 calls with path out (real writes) | 46 ms (×2.1) |
| event-loop max lag under 8 concurrent heavy calls | < 15 ms (Windows timer granularity) |
Fragment work (decrypt + strict evidence check) spreads across cores on large files: a 128MB fragmented file runs decrypt+strict in ~0.1s.
License
MIT — see LICENSE.
Metadata
Release files for decryptune 1.1.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| decryptune-1.1.3.tar.gz | 381.4 kB | With provenance | Details for decryptune-1.1.3.tar.gz |
Built distributions (wheels)
| File | Actions Reset | |||
|---|---|---|---|---|
| decryptune-1.1.3-cp312-abi3-win_arm64.whl | CPython 3.12 | abi3 | Windows ARM64 | Details for decryptune-1.1.3-cp312-abi3-win_arm64.whl |
| decryptune-1.1.3-cp312-abi3-win_amd64.whl | CPython 3.12 | abi3 | Windows x86-64 | Details for decryptune-1.1.3-cp312-abi3-win_amd64.whl |
| decryptune-1.1.3-cp312-abi3-manylinux_2_28_x86_64.whl | CPython 3.12 | abi3 | Linux glibc 2.28+ x86-64 | Details for decryptune-1.1.3-cp312-abi3-manylinux_2_28_x86_64.whl |
| decryptune-1.1.3-cp312-abi3-manylinux_2_28_aarch64.whl | CPython 3.12 | abi3 | Linux glibc 2.28+ ARM64 | Details for decryptune-1.1.3-cp312-abi3-manylinux_2_28_aarch64.whl |
Total release size: 1.9 MB
Release files / decryptune-1.1.3.tar.gz
| Download URL | decryptune-1.1.3.tar.gz |
|---|---|
| Size | 381.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c88dd83e33188eb0489b7f157fe527a049d33f5cf88fd036eeb77c190a6e0426
|
|
BLAKE2b-256 checksum How to use checksums |
5455332de327a59d215f5d1cb2d6efdb8dfa386fe23f894eae6ada209bedd725
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 18, 2026.
Transparency logRelease files / decryptune-1.1.3-cp312-abi3-win_arm64.whl
| Download URL | decryptune-1.1.3-cp312-abi3-win_arm64.whl |
|---|---|
| Size | 337.7 kB |
| Tags | CPython 3.12 Windows ARM64 abi3 |
|
SHA-256 checksum How to use checksums |
9511503ce69f35f827f45fd7f092f8068b4e9863f899a1ea3782174d5583990b
|
|
BLAKE2b-256 checksum How to use checksums |
e19032eeb8472e241e61261ff3d79776c96eb2df4d2ac9d452c552d400a27f2e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 18, 2026.
Transparency logRelease files / decryptune-1.1.3-cp312-abi3-win_amd64.whl
| Download URL | decryptune-1.1.3-cp312-abi3-win_amd64.whl |
|---|---|
| Size | 357.2 kB |
| Tags | CPython 3.12 Windows x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
b4d83936137e7275c5fce71652bf51a4256518514ef8b35d6e3be4bd67e91432
|
|
BLAKE2b-256 checksum How to use checksums |
728aac0ef93863154819acb4ecdd1b830bbfa01a0a660493051478a7630b1d46
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 18, 2026.
Transparency logRelease files / decryptune-1.1.3-cp312-abi3-manylinux_2_28_x86_64.whl
| Download URL | decryptune-1.1.3-cp312-abi3-manylinux_2_28_x86_64.whl |
|---|---|
| Size | 423.7 kB |
| Tags | CPython 3.12 Linux glibc 2.28+ x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
822bf8410ac508531336ef473209d1537eb46d08ee880b0aab6b6c2eea067d34
|
|
BLAKE2b-256 checksum How to use checksums |
9d6693b4d580734b6adb43d88c2b55c5bf640d484f5e9d05c681e2cf05c69ce8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 18, 2026.
Transparency logRelease files / decryptune-1.1.3-cp312-abi3-manylinux_2_28_aarch64.whl
| Download URL | decryptune-1.1.3-cp312-abi3-manylinux_2_28_aarch64.whl |
|---|---|
| Size | 406.3 kB |
| Tags | CPython 3.12 Linux glibc 2.28+ ARM64 abi3 |
|
SHA-256 checksum How to use checksums |
b5925fa112363603ca17def93c8df521367587ddc6eaf71b071697fada11c51e
|
|
BLAKE2b-256 checksum How to use checksums |
a4442fa37127d9ec1cad2624514cadf2312fa9244d7d2410eac51a61491ff1a1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 18, 2026.
Transparency logSecurity for decryptune 1.1.3
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
All 5 files in this release have been uploaded with provenance metadata.
Attestation for decryptune-1.1.3.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 18, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.