opuscodec
Python bindings and self-contained Opus CLI builds, with QEXT enabled by default.
opuscodec packages three things together:
OpusBufferedEncoder/OpusBufferedDecoderPython bindings- self-contained
opusenc/opusdecrelease binaries - vendored Xiph dependencies, built from source when needed
Stable dependency set:
opus1.6.1opus-tools0.2libogg1.3.6opusfile0.12libopusenc0.3
Why this package
- no system Opus install required by default
- runtime + build-time QEXT control
- Python API and CLI assets released from one repo
- PyPI wheels for supported targets, source build fallback everywhere else
Installation
PyPI (recommended)
python -m pip install opuscodec==0.1.3
GitHub Release asset
python -m pip install "https://github.com/fishaudio/opuscodec/releases/download/v0.1.3/<wheel-file-name>.whl"
Example Linux wheel install commands. Exact manylinux policy tags may include more than one compatible tag.
python -m pip install ./opuscodec-0.1.3-cp312-cp312-*x86_64.whl
python -m pip install ./opuscodec-0.1.3-cp312-cp312-*aarch64.whl
Source build
make test
Common commands:
make install # editable install + test deps
make test # run pytest
make wheel # build wheel into dist/wheels
make binaries # build opusenc/opusdec into dist/bin
make clean # clean build artifacts
Python example
import numpy as np
import opuscodec
sr = 48000
x = (0.1 * np.sin(2 * np.pi * 440 * np.arange(sr) / sr) * 32767).astype(np.int16).reshape(-1, 1)
enc = opuscodec.OpusBufferedEncoder(sample_rate=sr, channels=1)
packet = enc.write(x) + enc.flush()
dec = opuscodec.OpusBufferedDecoder()
y = dec.decode(packet)
print(y.shape, opuscodec.opus_version(), opuscodec.qext_enabled(), enc.qext_enabled())
Disable runtime QEXT for one encoder instance:
enc = opuscodec.OpusBufferedEncoder(sample_rate=48000, channels=1, qext=False)
Standalone binary usage
After downloading release binaries:
tar -xzf opuscodec-v0.1.3-linux-amd64-binaries.tar.gz
tar -xzf opuscodec-v0.1.3-linux-arm64-binaries.tar.gz
chmod +x opusenc opusdec
WAV roundtrip
./opusenc input.wav output.opus
./opusdec output.opus roundtrip.wav
opusenc enables QEXT by default in this repository build. Disable it explicitly for comparison tests:
./opusenc --set-ctl-int 4056=0 input.wav output-noqext.opus
Raw PCM roundtrip
Encode raw PCM (mono, 48k, s16le) to Opus:
./opusenc --raw --raw-bits 16 --raw-rate 48000 --raw-chan 1 input.pcm output.opus
Decode Opus back to PCM:
./opusdec output.opus decoded.pcm
Build configuration
Defaults: vendored dependencies; QEXT enabled.
Optional environment variables:
OPUSCODEC_ENABLE_QEXT=0— disable QEXTOPUSCODEC_USE_SYSTEM_DEPS=1— use system libraries instead of vendored buildOPUSCODEC_DEPS_PREFIX=/path/to/prefix— custom dependency prefix
When QEXT is enabled at build time, packaged opusenc binaries also enable OPUS_SET_QEXT(1) by default.
Repository layout
.
├── .github/workflows/build.yml
├── Makefile
├── pyproject.toml
├── setup.py
├── src/
│ └── opuscodec_bindings.cpp
├── scripts/
│ ├── build_deps.sh
│ └── build_binaries.sh
├── tests/
│ └── test_bindings.py
├── opusenc.py
└── opusdec.py
Release automation
On tag push (for example v0.1.3), GitHub Actions will:
- run tests on Linux + macOS
- build PyPI-compatible manylinux wheels for Linux x86_64 + aarch64
- build macOS arm64 wheels
- build an
sdist - publish wheel + sdist artifacts to PyPI via OIDC
- create a GitHub Release and upload wheels + binary tarballs
License
Apache License 2.0. See LICENSE.
Metadata
Release files for opuscodec 0.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 | |
|---|---|---|---|
| opuscodec-0.1.3.tar.gz | 11.5 kB | Details |
Built distributions (wheels)
| File | Reset | |||
|---|---|---|---|---|
| opuscodec-0.1.3-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl | CPython 3.12 | CPython 3.12 | Linux glibc 2.27+ x86-64, Linux glibc 2.28+ x86-64 | Details |
| opuscodec-0.1.3-cp312-cp312-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl | CPython 3.12 | CPython 3.12 | Linux glibc 2.26+ ARM64, Linux glibc 2.28+ ARM64 | Details |
| opuscodec-0.1.3-cp312-cp312-macosx_11_0_universal2.whl | CPython 3.12 | CPython 3.12 | macOS 11.0+ universal2 (ARM64, x86-64) | Details |
| opuscodec-0.1.3-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl | CPython 3.11 | CPython 3.11 | Linux glibc 2.28+ x86-64, Linux glibc 2.27+ x86-64 | Details |
| opuscodec-0.1.3-cp311-cp311-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl | CPython 3.11 | CPython 3.11 | Linux glibc 2.26+ ARM64, Linux glibc 2.28+ ARM64 | Details |
| opuscodec-0.1.3-cp311-cp311-macosx_11_0_universal2.whl | CPython 3.11 | CPython 3.11 | macOS 11.0+ universal2 (ARM64, x86-64) | Details |
Total release size: 2.9 MB
Release files / opuscodec-0.1.3.tar.gz
| Download URL | opuscodec-0.1.3.tar.gz |
|---|---|
| Size | 11.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
1c78c3a2a860596e10a01d99ba167cb0eb484549e1ff41850bbb581f60e24b35
|
|
BLAKE2b-256 checksum How to use checksums |
2d86fb93253d6f216b8c1bec92373377205f8bfcf1748f86b8013fce3bf9a2a2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
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 Jun 7, 2026.
Transparency logRelease files / opuscodec-0.1.3-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
| Download URL | opuscodec-0.1.3-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl |
|---|---|
| Size | 456.4 kB |
| Tags | CPython 3.12 Linux glibc 2.27+ x86-64 Linux glibc 2.28+ x86-64 |
|
SHA-256 checksum How to use checksums |
46cdd92e44efac0b4069afb3b937a2723b74034ab61e69884531853e06294728
|
|
BLAKE2b-256 checksum How to use checksums |
4f9c7aaa1c2ed82885e92f7302ed9896befd80dd022b2b514450e6ab1a6ad862
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
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 Jun 7, 2026.
Transparency logRelease files / opuscodec-0.1.3-cp312-cp312-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl
| Download URL | opuscodec-0.1.3-cp312-cp312-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl |
|---|---|
| Size | 445.4 kB |
| Tags | CPython 3.12 Linux glibc 2.26+ ARM64 Linux glibc 2.28+ ARM64 |
|
SHA-256 checksum How to use checksums |
8173f41b538a6cc1a306f573fe43753d8227617de8bc08e6b69e016369be662d
|
|
BLAKE2b-256 checksum How to use checksums |
42215cf31a5eafa387ad731d7f74771448865dfa9b3c7ab58a8ab316f3a7087a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
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 Jun 7, 2026.
Transparency logRelease files / opuscodec-0.1.3-cp312-cp312-macosx_11_0_universal2.whl
| Download URL | opuscodec-0.1.3-cp312-cp312-macosx_11_0_universal2.whl |
|---|---|
| Size | 531.6 kB |
| Tags | CPython 3.12 macOS 11.0+ universal2 (ARM64, x86-64) |
|
SHA-256 checksum How to use checksums |
c33f874ab7cf3dea623998ecdf4440799c9ce628718c4e8911249158cd0ead8b
|
|
BLAKE2b-256 checksum How to use checksums |
364da17bb525037cb2d21df041ab94ec14dba4a257d02c590bbda8faf94549d4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
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 Jun 7, 2026.
Transparency logRelease files / opuscodec-0.1.3-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
| Download URL | opuscodec-0.1.3-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl |
|---|---|
| Size | 454.4 kB |
| Tags | CPython 3.11 Linux glibc 2.27+ x86-64 Linux glibc 2.28+ x86-64 |
|
SHA-256 checksum How to use checksums |
335fffc02c6f446bfa239e0fde142f33dae19922f67483ac26002b596e46e631
|
|
BLAKE2b-256 checksum How to use checksums |
f1165dfd5fde922125f1c633ed55f269294130f9220fdc8e48abf95506e7ba05
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
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 Jun 7, 2026.
Transparency logRelease files / opuscodec-0.1.3-cp311-cp311-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl
| Download URL | opuscodec-0.1.3-cp311-cp311-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl |
|---|---|
| Size | 443.5 kB |
| Tags | CPython 3.11 Linux glibc 2.26+ ARM64 Linux glibc 2.28+ ARM64 |
|
SHA-256 checksum How to use checksums |
dfbc27275340a81010ffab8e9bd05fed5decdb0cc382bcda0f7cd2ac256a637d
|
|
BLAKE2b-256 checksum How to use checksums |
bd5e62e60ee787cc49286e7605680c4ed2d935108572738e927658b56c8bf45f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
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 Jun 7, 2026.
Transparency logRelease files / opuscodec-0.1.3-cp311-cp311-macosx_11_0_universal2.whl
| Download URL | opuscodec-0.1.3-cp311-cp311-macosx_11_0_universal2.whl |
|---|---|
| Size | 525.5 kB |
| Tags | CPython 3.11 macOS 11.0+ universal2 (ARM64, x86-64) |
|
SHA-256 checksum How to use checksums |
176826a0c99b4848e9a52eb60ee82cf4dee41d50c33bad9300343b6f22e9bb2f
|
|
BLAKE2b-256 checksum How to use checksums |
f73dd841af484c6f7ffab9384d3734674857fa74ea65d80344fdbee86a9c6850
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
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 Jun 7, 2026.
Transparency log