Skip to main content

Convert any video to ASCII art playable in your terminal

Project description

vtoa

Video to ASCII — Convert any video to ASCII art playable in your terminal. [Fully vibecoded btw]

@@@@@@@@@@%%%%%%%%%%%%%@@@@@@@@@
@@@@@@##*+=-:..   ..::-=+*##@@@@
@@@@%#*+=-:.           .:-=+*#%@
@@@%#*+-:.               .:-+*#%
@@%#*+-:                   :-+*#
@%#*+-.       .::::::.       -+*
%#*+-.      .:-======-:.     .-+
#*+-       .:-+*####*+=-:.     -
*+-       .:-+*#%%%%#*+=-:.    .
+-.      .:-+*#%@@@@%#*+=-:.   .
-.      .:-+*#%@@@@@@%#*+-:.    
       .:-+*#%@@@@@@@@%#*+-:.   

Installation

pip install -e .

Or install dependencies directly:

pip install opencv-python numpy

Quick Start

Command Line

# Play a video with default settings
vtoa video.mp4

# Specify output width
vtoa video.mp4 --width 120

# Use block characters for denser output
vtoa video.mp4 --preset blocks

# Invert for light terminal backgrounds
vtoa video.mp4 --invert

# Loop continuously
vtoa video.mp4 --loop

# Custom character set
vtoa video.mp4 --chars "@#*+=-. "

Python API

from vtoa import play_video, AsciiPlayer, AsciiConverter
import cv2

# Simple one-liner
play_video("video.mp4")

# With options
play_video(
    "video.mp4",
    width=100,
    invert=True,
    loop=True
)

# Using the player class
player = AsciiPlayer("video.mp4", width=80)
print(f"Duration: {player.duration:.1f}s")
print(f"Frames: {player.frame_count}")
player.play()

# Process frames manually
player = AsciiPlayer("video.mp4")
for frame in player.frames():
    print(frame.content)
    print(f"Timestamp: {frame.timestamp:.2f}s")
    break  # Just show first frame

# Convert a single image/frame
from vtoa import frame_to_ascii
image = cv2.imread("image.jpg")
ascii_art = frame_to_ascii(image, width=60)
print(ascii_art)

Character Presets

Preset Characters Best For
detailed @%#*+=-:. General use, good detail
simple @#=-. Faster rendering
blocks █▓▒░ Dense output, block style

CLI Options

usage: vtoa [-h] [-V] [-w WIDTH] [-H HEIGHT] [-p {detailed,simple,blocks}]
            [-c CHARS] [-i] [-l] [-s] video

positional arguments:
  video                 Path to the video file

options:
  -h, --help            Show this help message and exit
  -V, --version         Show version number and exit
  -w, --width WIDTH     Output width in characters
  -H, --height HEIGHT   Output height in characters
  -p, --preset PRESET   Character preset (detailed/simple/blocks)
  -c, --chars CHARS     Custom character set (dark to light)
  -i, --invert          Invert brightness mapping
  -l, --loop            Loop the video
  -s, --no-status       Hide the status bar

How It Works

  1. Read — OpenCV reads video frames
  2. Grayscale — Convert each frame to grayscale
  3. Resize — Scale to fit terminal dimensions (adjusting for character aspect ratio)
  4. Map — Map pixel brightness values to ASCII characters
  5. Display — Render frames with proper timing to maintain video speed

Requirements

  • Python 3.8+
  • OpenCV (opencv-python)
  • NumPy

License

MIT

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

vtoa-0.1.0.tar.gz (11.7 kB view details)

Uploaded Source

Built Distribution

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

vtoa-0.1.0-py3-none-any.whl (11.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: vtoa-0.1.0.tar.gz
  • Upload date:
  • Size: 11.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for vtoa-0.1.0.tar.gz
Algorithm Hash digest
SHA256 51e904535436ea8b2c2cb61d54b3024741ff65b2d4c3564259b9fc1904a39334
MD5 cedef543db7d72436fb618614eaab2b6
BLAKE2b-256 146d8598d4300877f5df089b47e1e31d1bc4126c0da4296d1c7f35aa25186e66

See more details on using hashes here.

Provenance

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

Publisher: publish.yml on tanmaysachan/vtoa

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

File details

Details for the file vtoa-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: vtoa-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 11.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for vtoa-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 7bd7f9b9445a1e4faae0e94f99a43e0aa63a425d20094241f7e58245f7e445e8
MD5 530944e53533cf2897bbb9b9fc2806d8
BLAKE2b-256 b7d944859cf760e7d7c29a8e34367dfa6a1861d9e543e99fb8a03f928cf4ce57

See more details on using hashes here.

Provenance

The following attestation bundles were made for vtoa-0.1.0-py3-none-any.whl:

Publisher: publish.yml on tanmaysachan/vtoa

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

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