| Crates.io | slpz |
| lib.rs | slpz |
| version | 1.3.0 |
| created_at | 2024-08-29 23:11:34.630998+00 |
| updated_at | 2025-08-13 18:17:25.941417+00 |
| description | Compresses and decompresses between the slp and slpz Slippi replay formats. |
| homepage | |
| repository | https://github.com/AlexanderHarrison/slpz |
| max_upload_size | |
| id | 1357217 |
| size | 12,285,777 |
Slpz compresses and decompresses Slippi replay (slp) files. The slpz format is 100% supported by rwing, meaning you can watch back, browse, and export savestates even while your replays are compressed.
You can expect slpz files to be around 8x to 12x times smaller than slp files for regular matches. (~3Mb down to ~300Kb). On my old thinkpad it can compress around 120 replays per second and decompress around 340 replays per second.
Compression is done with zstd. zstd is not required on the user's computer. The library is statically linked at compile time.
Important information, such as player tags, stages, date, characters, etc. all remain uncompressed in the slpz format. This allows slp file browsers to easily parse and display this information without needing to decompress the replay.
You can download slpz here. This program allows commandline compression and decompression of both files and entire directories.
For example, the command slpz -r --rm -x ~/Slippi/ will compress every replay in your Slippi replay directory.
The command slpz -r --rm -d ~/Slippi/ will decompress them.
Rwing has a straightfoward process to compress/decompress built-in, so you can use rwing if you don't want to use the command line.
Programmers can also use slpz as a library.
24 bytes.
All offsets are from file start.
The sections must be contiguous. E.x. the metadata section is always from slpz[metadata_offset..compressed_events_offset],
and the compressed events section is from slpz[compressed_events_offset..].
This is equivalent to the 'Event Payloads' event in the SLP Spec.
This is equivalent to the 'Game Start' event in the SLP Spec.
This is equivalent to the 'Metadata' event in the SLP Spec.
This is reordered events passed through zstd compression.
Reordering the bytes in events increases the compression ratio ~2x.
A normal slp file is a stream of events consisting of a command byte and statically sized payload. Event payloads are almost all the same, so we can reorder the data to increase the compressability of the data.
We first turn the event stream into a list of command bytes, keeping the order but removing the payloads. Then a list of all of the first bytes in the payloads for events with command 0, then all of the second bytes in the payloads for events with command 0, all the way to a list of the last bytes of the payloads for command 255.
To undo this reordering we also need the number of total events, so we put this in as 4 bytes at the start.
cmd ABCD cmd2 EFG cmd ABCD cmd3 HI cmd2 EFG
converts to:
// Event Order
5 cmd cmd2 cmd cmd3 cmd2
// Reordered Event Data
AABBCCDD EEFFGG HI
slippc is very impressive. They have achieved much higher compression rates by abusing the contents of events. However, in my opinion, this comes with two big drawbacks: