Skip to main content

Encode and decode slow-scan television (SSTV) transmissions in Python. This package wraps the Rust sstv crate.

This package aims to be the definitive SSTV library for Python. Please create an issue or a pull request if you find a bug or are missing a feature.

Installation

pip install sstv

Usage

Decoding

sstv.decode_from_wav() takes a WAV recording and returns every SSTV image found in it as a Pillow image:

import sstv

for image in sstv.decode_from_wav("recording.wav"):
    image.save("decoded.png")

It accepts a path, in-memory WAV data (bytes), or a binary file-like object. The sample rate is read from the WAV header, only the first channel of multi-channel audio is used, and integer samples of any bit depth as well as float samples are converted to 16 bit. sstv.decode_from_mp3() works the same way for MP3 recordings.

For audio from other sources, sstv.decode() takes raw samples as a one-dimensional numpy array — int16, or float32/float64 in [-1.0, 1.0] — plus the sample rate:

import soundfile

samples, sample_rate = soundfile.read("recording.flac")
images = sstv.decode(samples[:, 0], sample_rate)

By default the mode of each transmission is detected from the VIS code in its header. Both can be overridden:

# The transmission is known to be Robot 36
images = sstv.decode(samples, sample_rate, mode=sstv.Mode.ROBOT_36)

# The recording starts directly at the first scanline (no header)
images = sstv.decode(samples, sample_rate, mode=sstv.Mode.ROBOT_36, header=False)

Both keyword arguments work the same on decode_from_wav() and decode_from_mp3().

Decode metadata is stored in each image's info dict:

image.info["sstv_mode"]      # e.g. sstv.Mode.ROBOT_36 — which mode was detected
image.info["sstv_complete"]  # False if the signal cut off mid-image;
                             # the rows the signal did not carry are black

Note that Pillow does not carry info through operations like crop or resize, so read the metadata before transforming the image.

Encoding

sstv.encode_to_wav_file() turns an image into a WAV file; sstv.encode_to_wav() returns the WAV data as bytes instead, and sstv.encode() the raw int16 samples, e.g. for feeding an audio device:

from PIL import Image

photo = Image.open("photo.png").resize((320, 240))
sstv.encode_to_wav_file(photo, "out.wav", sstv.Mode.ROBOT_36)

data = sstv.encode_to_wav(photo, sstv.Mode.ROBOT_36)
samples = sstv.encode(photo, sstv.Mode.ROBOT_36, sample_rate=44_100)

sstv.encode_to_mp3() / sstv.encode_to_mp3_file() produce the transmission as mono 128 kbit/s MP3 instead; their sample rate must be one MP3 supports (8000-48000, see the docstring).

The image can be a PIL.Image (converted to RGB internally) or a (height, width, 3) uint8 numpy array, and its dimensions must match the mode's resolution — resize with image.resize((mode.image_width, mode.image_height)). The transmission includes the calibration header, so decoders can detect the mode.

Supported modes: Scottie 1/2/DX, Martin 1/2, Robot 36/72, Wrasse SC2-180, Pasokon P3/P5/P7, PD 50/90/120/160/180/240/290.

Development

Built with maturin. To build and test locally:

uv venv && uv pip install -e '.[dev]'
uv run pytest

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

sstv-0.1.0.tar.gz (60.4 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

sstv-0.1.0-cp310-abi3-win_amd64.whl (352.1 kB view details)

Uploaded CPython 3.10+Windows x86-64

sstv-0.1.0-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (517.1 kB view details)

Uploaded CPython 3.10+manylinux: glibc 2.17+ x86-64

sstv-0.1.0-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (509.2 kB view details)

Uploaded CPython 3.10+manylinux: glibc 2.17+ ARM64

sstv-0.1.0-cp310-abi3-macosx_11_0_arm64.whl (471.8 kB view details)

Uploaded CPython 3.10+macOS 11.0+ ARM64

sstv-0.1.0-cp310-abi3-macosx_10_12_x86_64.whl (472.1 kB view details)

Uploaded CPython 3.10+macOS 10.12+ x86-64

File details

Details for the file sstv-0.1.0.tar.gz.

File metadata

  • Download URL: sstv-0.1.0.tar.gz
  • Upload date:
  • Size: 60.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for sstv-0.1.0.tar.gz
Algorithm Hash digest
SHA256 67854f1595e60920635894e64c131691b56f2a7235d9c75c14712a399f395f07
MD5 e7a78478f9b76cee9409aafd67817a4b
BLAKE2b-256 98962bad95e265aae5f2301c9db3de85d116f0b3aff80fd645ca9bf2e3182d85

See more details on using hashes here.

Provenance

The following attestation bundles were made for sstv-0.1.0.tar.gz:

Publisher: release.yml on unexcellent/sstv-py

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file sstv-0.1.0-cp310-abi3-win_amd64.whl.

File metadata

  • Download URL: sstv-0.1.0-cp310-abi3-win_amd64.whl
  • Upload date:
  • Size: 352.1 kB
  • Tags: CPython 3.10+, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for sstv-0.1.0-cp310-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 dc1aa77b260a740ee569c196b907bdd92ba436f6ddeb479ff6ade0a93f331dd2
MD5 c5f430dec091d13c1e192b6146e187ac
BLAKE2b-256 5cc66b9623f412c9d75874d6a9fe5d32fe7a4cf157c1b452b1a42c8d42f66752

See more details on using hashes here.

Provenance

The following attestation bundles were made for sstv-0.1.0-cp310-abi3-win_amd64.whl:

Publisher: release.yml on unexcellent/sstv-py

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file sstv-0.1.0-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for sstv-0.1.0-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 926547b5812f702bf951e77e27af14264ceb49895faefb284796464b21bc58e4
MD5 8c586b3e4a559f9213ae1c51c7db2bd9
BLAKE2b-256 7537cc34c46fae6ebd33235e86fb5c2e9a949c24ac09e8502bd7a6c4a6133573

See more details on using hashes here.

Provenance

The following attestation bundles were made for sstv-0.1.0-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: release.yml on unexcellent/sstv-py

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file sstv-0.1.0-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for sstv-0.1.0-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 02ec497f806edb8eefba85e588d58232402a201998a7d8de0e7c26893329cdd9
MD5 10946c7390ad3932f936daf880487cad
BLAKE2b-256 9539f556263c512b3fe377c064cb576f9cd466dae5ce099c2c30ade14db45aae

See more details on using hashes here.

Provenance

The following attestation bundles were made for sstv-0.1.0-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl:

Publisher: release.yml on unexcellent/sstv-py

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file sstv-0.1.0-cp310-abi3-macosx_11_0_arm64.whl.

File metadata

  • Download URL: sstv-0.1.0-cp310-abi3-macosx_11_0_arm64.whl
  • Upload date:
  • Size: 471.8 kB
  • Tags: CPython 3.10+, macOS 11.0+ ARM64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for sstv-0.1.0-cp310-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 31c8c682bb295cc10ae686e1a7fb360d8fd9ff09f2253abee448aeb5cdcf170e
MD5 3ddb06112114acbe88dde8d6c795c258
BLAKE2b-256 339667afd16963d30a01508e705a07bc215d4cebc69356121133587f4ec103b8

See more details on using hashes here.

Provenance

The following attestation bundles were made for sstv-0.1.0-cp310-abi3-macosx_11_0_arm64.whl:

Publisher: release.yml on unexcellent/sstv-py

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file sstv-0.1.0-cp310-abi3-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for sstv-0.1.0-cp310-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 b1b72fc678824f3513ffb25d54bc9c06c837923774d9303d650459f0816c4598
MD5 263044b19fb686706dbe422e45f8df86
BLAKE2b-256 83ea332722d5936fdb0b8e0902d65d216f1c5e9c0f927c60f01afcd85ff36572

See more details on using hashes here.

Provenance

The following attestation bundles were made for sstv-0.1.0-cp310-abi3-macosx_10_12_x86_64.whl:

Publisher: release.yml on unexcellent/sstv-py

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

This release

0.1.0 This release

6 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page