PyCriCodecs
Python frontend with a C++ backend for managing Criware formats. Although for some tasks, python is used purely.
This fork is created from the archived branch of Youjose/CriCodecs.
Unless specfied, all the first person pronouns (i.e. 'I') below refers to the original author.
Supporting
I am running this on Python 3.11, although other earlier versions might work
So far this lib supports in terms of:
Extracting:
- ACB/AWB (Incorrect filenames in extraction.)
- USM (Any USM there is)
- CPK (Most CPK's)
Decoding:
- ADX (All versions)
- HCA (All versions)
Building:
- CPK (All CPK modes)
- AWB (Anything)
- USM (VP9 support only, ADX or HCA Audio support, multiple audio streams support as well, VP9/ADX only tested and for sure working!)
Encoding:
- HCA (HCA Version 2.0)
- ADX (All versions, any bitdepth, any blocksize, any HighPass Frequence, All encoding versions)
Installation and Usage
To install run
python setup.py install
or alternatively
pip install .
Note: all libs (except ADX) here are standardized to take either a filename/path or bytes/bytearray, so you can swap both.
Also, for audio related codecs, the looping input and output is defined in the metadata, the WAV file will not loop, but it will have a "smpl" chunk in the header, same if you want to encode a looping HCA or an ADX, the WAV must have a smpl chunk.
Otherwise it will loop normally.
Usage:
For ADX decoding and encoding:
from PyCriCodecs import *
# Decoding:
adx_data = open("path_to_adx_file.adx", "rb").read()
wavfilebytes = ADX.decode(adx_data) # Decode will return bytes object containing decoded ADX data as a wav file.
# Encoding:
wav_data = open("path_to_wav_file.wav", "rb").read()
adxbytes = ADX.encode(wav_data) # Returns an ADX file as bytes, check the wiki for more options.
For HCA decoding and encoding:
from PyCriCodecs import *
hcaObj = HCA("filename.hca", key=0xCF222F1FE0748978) # You can change the key, or remove it if the HCA is not encrypted. Key can be a hex string.
wavfile = hcaObj.decode() # Gets you the wav file after decoding.
wavObj = HCA("filename.wav")
hcabytes = wavObj.encode(encrypt=True) # and you will get an HCA file.
# You can provide a key from when initializing, otherwise it will default to the default key, you can also encrypt keyless with keyless=true.
# You can also force disable looping on HCA output by force_not_looping = True.
wavObj.encrypt()
# or
hcaObj.decrypt()
# Any works, given it can be decrypted or encrypted as an HCA. Would do it. You can also pass a key to ".encrypt()", ".decrypt()" uses the init key.
For CPK extraction and building:
from PyCriCodecs import *
# Extraction:
CpkObj = CPK("filename.cpk")
CpkObj.extract() # Will extract files to a dir names "filename"
CpkObj.extract_file() # Extract a file from a given filename (or an ID for CPKMode 0)
# Building:
CPKBuilder("dirname", "outfile.cpk", CpkMode=1) # CpkMode is important sometimes, get your target mode by extracting a sample table.
# Given a directory, it will take that directory as root, and builds a CPK for the directories and files inside.
# Output would be a cpk file as specified.
For USM extraction and Building:
-Note that USM building might be a little bit unstable due to bad code, feel free to open any issues if something did went wrong.
from PyCriCodecs import *
# Extraction:
usmObj = USM("filename.cpk") # or bytes, you can add a key by key="KEYINHEXGOESHERE"
usmObj.extract() # extracts all USM contents in the current directory. You can add a directory with extract(dirname = "Example")
# You can also demux the USM internally and manage with the output bytes all you want.
usmObj.demux() # Then you have access to output property.
usmObj.output # This is a dict containing all chunks in the USM, each key has a value of a list with bytearrays.
usmObj.get_metadata() # Not for the user specifically, but if you want to look at the info inside, this is one way.
# Building:
# Needs at least a video to be able to build one USM file, you can add audio pretty easily too.
usmObj = USMBuilder("filename.ivf", "filename.wav", key=0xKEYGOESINHERE, audio_codec="adx", encryptAudio=True) # Basic USM
# You can add a list of audio paths/filenames as well instead of filenames, and that will be added into audio streams in order.
usmObj.build() # Due to bad code, this is heavy on performance and will take some seconds based of the input files.
usmbytes = usmObj.get_usm() # Will return the USM file as bytes.
For ACB or AWB extraction:
from PyCriCodecs import *
# ACB Extraction:
acbObj = ACB("filename.acb") # It will attempt to open "filename.awb" as well if there are no sub-banks in the ACB.
acbObj.extract(dirname="dirname", decode=True, key=key) # You can turn off decoding by decode=False.
# AWB Extraction:
awbObj = AWB("filename.awb")
# You can either loop through the audios inside with:
for file in awbObj.getfiles():
file # file bytes.
open("file.hca or anything", wb).write(file)
# or you can call the extract function, not advised.
awbObj.extract()
Check the Wiki for my thoughts, plans, more options, and some details as well for documentation.
TODO List
- Add ACB building.
- Add correct ACB extraction.
Currently Known Bugs
- USM Building is not stable, and currently does not work at all because I changed the ADX api.
- Not important, and might not fix: ADX encoding and decoding at higher bitdepths (11-15) adds popping noise.
- Some CPK's that has the same filename for every file in the entry will overwrite each other.
- Probably many more I am unaware of, report if you find any.
Credits
- vgmstream for HCA code.
- VGAudio for ADX codec, and HCA encoding, both of which I ported into C++ but modified the ADX lib greatly.
- K0lb3 for helping a lot with python and Cpython, as well as helping me writing some of the code.
- bnnm for his various contributions on audio formats, helped me a lot with adding ADX and HCA support.
- Nyagamon for a lot of what he did for criware formats.
- donmai and his writeup of CriWare's UTF format.
- 9th for also helping me with some python knowledge.
Metadata
Release files for pycricodecs-archive 0.4.11
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| pycricodecs_archive-0.4.11.tar.gz | 36.5 kB | Details |
Built distributions (wheels)
Total release size: 2.6 MB
Release files / pycricodecs_archive-0.4.11.tar.gz
| Download URL | pycricodecs_archive-0.4.11.tar.gz |
|---|---|
| Size | 36.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
fc7153b2e17b6ed54eb63d5b943133f8a5114ca84ce897eaad15f59bc748988a
|
|
BLAKE2b-256 checksum How to use checksums |
560ecf0f91d9255f0a80ac3a172133ab215dfcc6d7d69fd76a721d8f02e6e342
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.11.4
|
Release files / pycricodecs_archive-0.4.11-pp38-pypy38_pp73-win_amd64.whl
| Download URL | pycricodecs_archive-0.4.11-pp38-pypy38_pp73-win_amd64.whl |
|---|---|
| Size | 131.8 kB |
| Tags | PyPy 3.8 PyPy 3.8 7.3 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
4184cd0dfe75c1f5a150105aa82c5792dc697170c382532fcb74afa5c53bffd9
|
|
BLAKE2b-256 checksum How to use checksums |
37b1607472d8e4fdfb52217614b981c8c941c868dc2212124e4f8eeefaa51fc2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.11.4
|
Release files / pycricodecs_archive-0.4.11-pp37-pypy37_pp73-win_amd64.whl
| Download URL | pycricodecs_archive-0.4.11-pp37-pypy37_pp73-win_amd64.whl |
|---|---|
| Size | 79.5 kB |
| Tags | PyPy 3.7 PyPy 3.7 7.3 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
05fb58d1e5c26f79810cbf1e6c0b66eceead0facd97aa4db0c9d79b845efed94
|
|
BLAKE2b-256 checksum How to use checksums |
302f109828e03f208f788410c2099d71bbbf6db47ccac4e2b99c264989a3b46a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.11.4
|
Release files / pycricodecs_archive-0.4.11-cp314-cp314-macosx_13_0_x86_64.whl
| Download URL | pycricodecs_archive-0.4.11-cp314-cp314-macosx_13_0_x86_64.whl |
|---|---|
| Size | 102.3 kB |
| Tags | CPython 3.14 macOS 13.0+ x86-64 |
|
SHA-256 checksum How to use checksums |
9875374e557b8fbbaad691df614d70b44e01e85408e7e2b1ae4dce062f618789
|
|
BLAKE2b-256 checksum How to use checksums |
0898a92f44be60b7648cb81061a479c9c21496a617651f23bc330c87363773d4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.7
|
Release files / pycricodecs_archive-0.4.11-cp313-cp313-win_amd64.whl
| Download URL | pycricodecs_archive-0.4.11-cp313-cp313-win_amd64.whl |
|---|---|
| Size | 79.6 kB |
| Tags | CPython 3.13 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
402497dceea48f641e31003ccfc17174514b0b0a1a7b03c4d0674c7905c483eb
|
|
BLAKE2b-256 checksum How to use checksums |
51122501e7cad51c8b020237fe716f24a6e7daebd3965e2c0db171b54bdba2da
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.11.4
|
Release files / pycricodecs_archive-0.4.11-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | pycricodecs_archive-0.4.11-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl |
|---|---|
| Size | 209.1 kB |
| Tags | CPython 3.13 Linux glibc 2.17+ x86-64 |
|
SHA-256 checksum How to use checksums |
05ba5829004e11a7ac734decf6853050b2433ea10d3468dcc6bc01e1aafedb48
|
|
BLAKE2b-256 checksum How to use checksums |
ed552146312d59596f8e57cdac0703eb721620496bfa117dbdd41b8a29669a36
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.10.12
|
Release files / pycricodecs_archive-0.4.11-cp312-cp312-win_amd64.whl
| Download URL | pycricodecs_archive-0.4.11-cp312-cp312-win_amd64.whl |
|---|---|
| Size | 79.6 kB |
| Tags | CPython 3.12 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
fa3704b564f6cecd96ec9855613a3a75548abe4ff7373651bf8ab6e17b45196f
|
|
BLAKE2b-256 checksum How to use checksums |
70c71d28f44da3752d1602cba91802d274d0aada01612044a871d8da4c391e7a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.11.4
|
Release files / pycricodecs_archive-0.4.11-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | pycricodecs_archive-0.4.11-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl |
|---|---|
| Size | 209.1 kB |
| Tags | CPython 3.12 Linux glibc 2.17+ x86-64 |
|
SHA-256 checksum How to use checksums |
4d397d6f0333c00328ff9a7de495bd690b435f4c11aaa79e4b9688036f695343
|
|
BLAKE2b-256 checksum How to use checksums |
657471c4c88791f711b442957519efefb4ad5ccabbe7201eb1f7379f9192221a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.10.12
|
Release files / pycricodecs_archive-0.4.11-cp311-cp311-win_amd64.whl
| Download URL | pycricodecs_archive-0.4.11-cp311-cp311-win_amd64.whl |
|---|---|
| Size | 79.5 kB |
| Tags | CPython 3.11 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
f435bf160834bdc4b49b2ec1989e73ab2f7d6e5aac64bd0f82721a8ee2c824f9
|
|
BLAKE2b-256 checksum How to use checksums |
4b130dc94412ae86df6870f4d037638596e12ee6cd21d4560917627ea639746f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.11.4
|
Release files / pycricodecs_archive-0.4.11-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | pycricodecs_archive-0.4.11-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl |
|---|---|
| Size | 209.0 kB |
| Tags | CPython 3.11 Linux glibc 2.17+ x86-64 |
|
SHA-256 checksum How to use checksums |
6059f1904b4d028202159647ccaff732c9e15f7be840252a28981bc6af77a200
|
|
BLAKE2b-256 checksum How to use checksums |
2b33daa721174deaa7535b7bc1a42cef25055a0329c777ba988ef2236888afe3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.10.12
|
Release files / pycricodecs_archive-0.4.11-cp310-cp310-win_amd64.whl
| Download URL | pycricodecs_archive-0.4.11-cp310-cp310-win_amd64.whl |
|---|---|
| Size | 79.5 kB |
| Tags | CPython 3.10 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
992a530599e5280f166cfed49e6aa3150c073f3430710384acbb39ee1083d0f7
|
|
BLAKE2b-256 checksum How to use checksums |
e74914d4dcbbbaa11ecba75560fc9e022bacdbb3c4bbdf10d7379766e4ea83c0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.11.4
|
Release files / pycricodecs_archive-0.4.11-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | pycricodecs_archive-0.4.11-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl |
|---|---|
| Size | 208.7 kB |
| Tags | CPython 3.10 Linux glibc 2.17+ x86-64 |
|
SHA-256 checksum How to use checksums |
d357d081817c46ad66f483e4779b12ca0df2bd06700af99f802d38a51f582ecd
|
|
BLAKE2b-256 checksum How to use checksums |
31b7c230b0f8f1f402dd4436ef2c404e06395fcb47a1b1f7be91eee540450189
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.10.12
|
Release files / pycricodecs_archive-0.4.11-cp39-cp39-win_amd64.whl
| Download URL | pycricodecs_archive-0.4.11-cp39-cp39-win_amd64.whl |
|---|---|
| Size | 79.5 kB |
| Tags | CPython 3.9 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
52b954e1c7670901918a380eff8597b81245bb52639a5c38b0c585efe84b8031
|
|
BLAKE2b-256 checksum How to use checksums |
031c52b27c5098ccf70ba157efc46782b8086fd9c7a29a85cd343bf8b4137701
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.11.4
|
Release files / pycricodecs_archive-0.4.11-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | pycricodecs_archive-0.4.11-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl |
|---|---|
| Size | 208.6 kB |
| Tags | CPython 3.9 Linux glibc 2.17+ x86-64 |
|
SHA-256 checksum How to use checksums |
01919f7e362118e1d311fdde26db105a75f18ea01d1485f5f701d7ab7c86572d
|
|
BLAKE2b-256 checksum How to use checksums |
fb93ee487d6feffd9ff31d221a741ac5b253367f034644c89bf85944d57339f8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.10.12
|
Release files / pycricodecs_archive-0.4.11-cp38-cp38-win_amd64.whl
| Download URL | pycricodecs_archive-0.4.11-cp38-cp38-win_amd64.whl |
|---|---|
| Size | 84.2 kB |
| Tags | CPython 3.8 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
c0fa2435aab1a04b258632fb60db43e0f70cec80ee92eed36f53d8ccec76c03c
|
|
BLAKE2b-256 checksum How to use checksums |
0e535c5c4da48469a6e3c1a86d63f6796d6bf746608c8593f52eba7ebf5a6556
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.11.4
|
Release files / pycricodecs_archive-0.4.11-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | pycricodecs_archive-0.4.11-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl |
|---|---|
| Size | 208.7 kB |
| Tags | CPython 3.8 Linux glibc 2.17+ x86-64 |
|
SHA-256 checksum How to use checksums |
e2d3d349ebc544f7269dc86e22658e7b6e11db65ba5ba67baccd228771b7077f
|
|
BLAKE2b-256 checksum How to use checksums |
78bd1e64ce0e9d3063a812f69ab2e67e591d62d01478b8341a73e1ebbbc134b4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.10.12
|
Release files / pycricodecs_archive-0.4.11-cp37-cp37m-win_amd64.whl
| Download URL | pycricodecs_archive-0.4.11-cp37-cp37m-win_amd64.whl |
|---|---|
| Size | 79.5 kB |
| Tags | CPython 3.7 CPython 3.7 pymalloc Windows x86-64 |
|
SHA-256 checksum How to use checksums |
cb59cf13bce7a118138aaab4024563634145ad99be1e1333d3ca7a73eac92306
|
|
BLAKE2b-256 checksum How to use checksums |
c7b6e9367fd714b0aa545e783408baddc7861f9b4a39d01240229e7d06eb6f16
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.11.4
|
Release files / pycricodecs_archive-0.4.11-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | pycricodecs_archive-0.4.11-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl |
|---|---|
| Size | 208.3 kB |
| Tags | CPython 3.7 CPython 3.7 pymalloc Linux glibc 2.17+ x86-64 |
|
SHA-256 checksum How to use checksums |
dac0c97451758a3bf9a4fbd677119c904cbe36110404384e7657ae52628a438d
|
|
BLAKE2b-256 checksum How to use checksums |
ed353760e5f9e3d4fa68310ab30d7673881c0aba73e1060f743c1825ef166787
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.10.12
|
Release files / pycricodecs_archive-0.4.11-cp36-cp36m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | pycricodecs_archive-0.4.11-cp36-cp36m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl |
|---|---|
| Size | 208.3 kB |
| Tags | CPython 3.6 CPython 3.6 pymalloc Linux glibc 2.17+ x86-64 |
|
SHA-256 checksum How to use checksums |
2d6e2e29b7c90f12ff8c464837e11d45d4e3664490677ce911cac6509ea96a23
|
|
BLAKE2b-256 checksum How to use checksums |
57a58cf53366b667d7a061674e8aaeb46ba3b07f45119a0e3f705520fec9769e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.10.12
|