Skip to main content

Convert asciinema .cast files to GIF and MP4, with a generic demo-recording engine

Project description

PyPI version Python Development Status Maintenance PyPI License


🎬 cast-studio

Convert asciinema .cast recordings into GIF and MP4 — and scaffold a generic demo-recording engine for any Python project.


📦 Installation

uv add cast-studio

System requirement: ffmpeg must be installed.

brew install ffmpeg        # macOS
apt-get install ffmpeg     # Ubuntu / Debian

🚀 Features

  • cast → GIF — High-quality 256-colour GIF via ffmpeg palette pass
  • cast → MP4 — H.264/x264 CRF-18 MP4 ready for GitHub Releases
  • Catppuccin Mocha theme — Beautiful dark terminal rendering with Pillow
  • Generic demo enginecast-run + demo.cfg for any project
  • Any shell command — Record pytest runs, scripts, CLIs — not just pytest
  • Multi-line descriptions — Pipe-separated description lines per run
  • python-base-command CLI — Structured, loggable CLI with cast / cast-render / cast-init

⚙️ Configuration

No .env needed. All config lives in demo.cfg:

PROJECT="my-library"
SUBTITLE="A short description"
INSTALL_CMD="pip install my-library"
REPO_URL="github.com/you/my-library"
PYPI_URL="pypi.org/project/my-library"

PYTEST=".venv/bin/pytest"
TESTS="tests/"

PAUSE_INTRO=2       # seconds after intro screen
PAUSE_BETWEEN=2     # seconds between runs
PAUSE_OUTRO=3       # seconds on outro screen

define_runs() {
  add_run "RUN 1 — feature A" "Short description." "$PYTEST $TESTS --flag"
  add_run "RUN 2 — script"   "Another feature."    "python scripts/my_script.py"
}

add_run "Title" "Line 1|Line 2" "any shell command" — use | for multi-line descriptions.


🛠️ How to Use

  1. Installuv add cast-studio (and brew install ffmpeg asciinema)
  2. Create .cfg — customise demo.cfg with your project's runs
  3. Recordasciinema rec -c "cast-run demo/demo.cfg" demo.cast
  4. Rendercast-render demo.cast assets/demo --gif-only --title "my demo"assets/demo.gif
  5. Embed — add ![demo](assets/demo.gif) to your README

🚀 Quick Start

# 1. Install
uv add cast-studio
brew install ffmpeg asciinema   # macOS

# 2. Create demo/demo.cfg — set PROJECT, SUBTITLE, INSTALL_CMD, define_runs()

demo/demo.cfg structure:

PROJECT="my-library"
SUBTITLE="A short description"
INSTALL_CMD="uv add my-library"
REPO_URL="github.com/you/my-library"
PYPI_URL="pypi.org/project/my-library"

define_runs() {
  add_run "RUN 1 — feature A" "Short description." "pytest tests/ --flag"
  add_run "RUN 2 — script"   "Another feature."    "python scripts/my_script.py"
}
# 3. Record
asciinema rec -c "bash cast-run demo/demo.cfg" assets/demo/demo.cast

# 4. Render to GIF and MP4
cast-render assets/demo/demo.cast assets/demo/demo --gif-only --title "my-library demo"  # -> `assets/demo/demo.gif`
cast-render assets/demo/demo.cast assets/demo/demo --mp4-only --title "my-library demo"  # -> `assets/demo/demo.mp4`

# 5. Embed in README
# ![demo](assets/demo.gif)

🎥 Demo

Watch demo


CLI Reference

cast-render

Flag Default Description
cast_file Path to .cast file
output_base Output path without extension
--title "" Title bar text
--gif-only Produce GIF only
--mp4-only Produce MP4 only
--render-fps 30 Internal PNG frame rate
--gif-fps 10 GIF output FPS
--mp4-fps 30 MP4 output FPS
--hold 3.0 Seconds to hold last frame
--keep-frames Keep temporary PNG frames

🤝 Contributing

If you have a helpful pattern or improvement to suggest: Fork the repo Create a new branch Submit a pull request I welcome additions that promote clean, productive, and maintainable development.


📄 License

MIT License — see LICENSE for details.


🙏 Thanks

Thanks for exploring this repository!
Happy coding!

GitHub   PyPI   Blog   LinkedIn

Project details


Download files

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

Source Distribution

cast_studio-0.1.1.tar.gz (14.9 kB view details)

Uploaded Source

Built Distribution

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

cast_studio-0.1.1-py3-none-any.whl (15.8 kB view details)

Uploaded Python 3

File details

Details for the file cast_studio-0.1.1.tar.gz.

File metadata

  • Download URL: cast_studio-0.1.1.tar.gz
  • Upload date:
  • Size: 14.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for cast_studio-0.1.1.tar.gz
Algorithm Hash digest
SHA256 8fffb5328e0f54ff3e636083c559ce31d029f29bf3457a837fe77cff834bf6ac
MD5 7b28cf328369e4c39dc9800b76afeed1
BLAKE2b-256 0e13e7359bb021ffdedad1e05d9f923cd7bcd1bd829d7fb4d9412466cc9a2757

See more details on using hashes here.

File details

Details for the file cast_studio-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: cast_studio-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 15.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for cast_studio-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 b657d7ec923c209ec3b44eb3909042ec49e10cffb6aab819a3c2ef46a3711e65
MD5 b9dbe28ba3b06be1608691e9bfa0dc0b
BLAKE2b-256 baee2bd56389f28f38286474be5106c5841df792ccb61aeb7bf1816144c1893f

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page