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

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.2.tar.gz (15.0 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.2-py3-none-any.whl (15.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: cast_studio-0.1.2.tar.gz
  • Upload date:
  • Size: 15.0 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.2.tar.gz
Algorithm Hash digest
SHA256 12696ec2a0a71b751096bf242ba1d7d62709b0fe25c9cb776ce3e5cd5ff9a73a
MD5 f682017ab81e79878702bd002c6c41e7
BLAKE2b-256 5f5bfbb5d9753d2151644364c80d97d9b2805bbbc882f245d43f856a9d3c8513

See more details on using hashes here.

File details

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

File metadata

  • Download URL: cast_studio-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 15.9 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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 122c5fb8723cbc4752bea795f5f4a59e7d6c9e2638c4eda65e33b18e16de6174
MD5 7a7f4713679f9eacf18dae585539cbd1
BLAKE2b-256 661f2997332dce878ef28b703a1e512b85e5b93c125e16c54f53f2ffe7c27c4d

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