Convert videos to ASCII art and play them in your terminal with full interactive controls, audio support, and export options.
pip install -r requirements.txtNote: For audio support, you'll also need ffmpeg installed on your system:
- macOS:
brew install ffmpeg - Linux:
sudo apt-get install ffmpeg(or your package manager) - Windows: Download from ffmpeg.org
YouTube URL:
python -m yt2ascii "https://www.youtube.com/watch?v=Q3_YxsWnjKg"Local video file:
python -m yt2ascii path/to/your/video.mp4Multiple videos (playlist):
python -m yt2ascii video1.mp4 video2.mp4 "https://youtube.com/watch?v=..."python -m yt2ascii [OPTIONS] SOURCE [SOURCE ...]
Options:
--width WIDTH Maximum width of ASCII output (default: 120)
--fps FPS Maximum FPS for playback (default: 24)
--invert Flip dark/light mapping
--no-color Disable ANSI colors
--charset CHARSET Character set preset: detailed, block, simple, alphanum
--no-audio Disable audio playback
--no-cache Disable frame caching
--no-adaptive Disable adaptive quality adjustment
--config PATH Path to YAML or JSON configuration file
--export FORMAT Export mode: text, gif, or html
--output PATH Output file path for export mode
--frame-by-frame Start in frame-by-frame mode
--help Show help messageCustom width and FPS:
python -m yt2ascii video.mp4 --width 80 --fps 15Block character set without colors:
python -m yt2ascii video.mp4 --charset block --no-colorExport to animated GIF:
python -m yt2ascii video.mp4 --export gif --output output.gifExport to HTML:
python -m yt2ascii video.mp4 --export html --output output.htmlExport to text file:
python -m yt2ascii video.mp4 --export text --output frames.txtUsing a configuration file:
python -m yt2ascii video.mp4 --config config.yamlDuring playback, use these keyboard controls:
- Space - Pause/Resume playback
- Left Arrow - Seek backward 5 seconds
- Right Arrow - Seek forward 5 seconds
- + / = - Increase playback speed (up to 3x)
- - - Decrease playback speed (down to 0.25x)
- F - Toggle fullscreen width
- Q - Quit playback
- Enter - Step one frame forward (when paused)
- Ctrl+C - Emergency quit
Choose from multiple character set presets:
- detailed (default) - Alphanumeric characters with symbols:
.-_:;^~+iIl1tfrjJYCLUXVTwqpdbmgKO0QNBMAESZ23456789%&#@` - block - Block characters:
░▒▓█ - simple - Simple dots:
.# - alphanum - Same as detailed
Create a YAML or JSON configuration file to set default options:
config.yaml:
target_width: 100
fps_cap: 20
invert: false
aspect_corr: 0.45
use_colors: true
charset: block
enable_audio: true
frame_cache_size: 100
adaptive_quality: true
auto_detect_terminal: trueconfig.json:
{
"target_width": 100,
"fps_cap": 20,
"invert": false,
"aspect_corr": 0.45,
"use_colors": true,
"charset": "block",
"enable_audio": true,
"frame_cache_size": 100,
"adaptive_quality": true,
"auto_detect_terminal": true
}Command-line arguments override configuration file settings.
- Python 3.7+
- OpenCV (
opencv-python) - NumPy
- yt-dlp (for YouTube downloads)
- pygame (for audio playback)
- Pillow (for GIF export)
- PyYAML (for YAML config files, optional)
- ffmpeg (system dependency, for audio extraction)
Audio not playing:
- Make sure
ffmpegis installed and in your PATH - Try
--no-audioto disable audio if it's causing issues
Keyboard controls not working:
- On Windows, some terminals may have limited support
- Try using a different terminal (Windows Terminal, PowerShell, etc.)
Slow playback:
- Reduce
--fpsor--width - Use
--no-cacheif memory is limited - Try
--charset simplefor faster rendering
Colors not showing:
- Check if your terminal supports ANSI colors
- Use
--no-colorto disable if causing issues - The script auto-detects terminal capabilities
This project is open source. Feel free to use and modify as needed.