A Python-based multimedia application that converts video frames into real-time ASCII art with synchronized audio playback.
ASCIImator reads a video file frame-by-frame, converts each frame into grayscale, maps pixel intensities to ASCII characters, and displays the result live in a Pygame window. Audio can be played alongside the video to create a complete retro-style viewing experience.
This project demonstrates practical skills in computer vision, multimedia systems, and real-time rendering, packaged as a clean, self-contained application with a focus on:
- โก Real-time performance optimization
- ๐ฏ Clear algorithmic design
- ๐ ๏ธ Practical use of Python multimedia libraries
|
Real-Time Conversion Live video-to-ASCII rendering |
Audio Sync Optional synchronized playback |
Pygame Rendering Smooth window-based display |
Customizable Resolution & font control |
- ๐ Real-time video-to-ASCII conversion
- ๐ Optional audio synchronization
- ๐ฅ Live rendering using Pygame
- โ๏ธ Configurable resolution and font size
- ๐จ Custom grayscale-to-ASCII character mapping
- ๐ฌ Support for multiple video formats
- opencv-python โ Video capture and frame processing
- pygame โ Window rendering and audio playback
- numpy โ Efficient numerical operations
ASCIImator/
โ
โโโ app.py # Main application logic
โโโ vid6.mp4 # Sample video file (user-provided)
โโโ 1.mp3 # Sample audio file (user-provided)
โโโ requirements.txt # Python dependencies
โโโ README.md # Project documentation
git clone https://github.com/aryan-r03/ASCIImator.git
cd ASCIImatorpython3 -m venv venv
source venv/bin/activatepython -m venv venv
venv\Scripts\activatepip install -r requirements.txtopencv-python>=4.5.0
pygame>=2.0.0
numpy>=1.19.0python app.pyThe application will:
- Load the specified video file
- Initialize the Pygame window
- Start real-time ASCII conversion
- Play synchronized audio (if enabled)
You can control output quality and behavior directly from the configuration section in app.py:
# Configuration
VIDEO_PATH = "vid6.mp4" # Path to your video file
AUDIO_PATH = "1.mp3" # Set to None to disable audio
CHAR_WIDTH = 100 # ASCII output width (higher = more detail)
FONT_SIZE = 10 # Font size for rendering| Parameter | Type | Default | Description |
|---|---|---|---|
VIDEO_PATH |
str | "vid6.mp4" | Input video file path |
AUDIO_PATH |
str | "1.mp3" | Audio file path (None to disable) |
CHAR_WIDTH |
int | 100 | ASCII output width (detail level) |
FONT_SIZE |
int | 10 | Rendering font size |
|
Capture Frames OpenCV video processing |
Resize & Convert Grayscale transformation |
Pixel Mapping Intensity to ASCII |
Render Display Pygame window output |
Audio Sync Synchronized playback |
- Frame Capture: OpenCV reads video frames sequentially
- Preprocessing: Frames are resized and converted to grayscale
- ASCII Mapping: Pixel intensities (0-255) map to ASCII characters
- Rendering: Pygame displays the ASCII grid in real-time
- Synchronization: Audio playback matches video frame timing
The conversion uses a gradient of characters based on visual density:
ASCII_CHARS = " .:-=+*#%@"
# Space (lightest) โ @ (darkest)VIDEO_PATH = "my_video.mp4"
AUDIO_PATH = "my_audio.mp3"
CHAR_WIDTH = 120
FONT_SIZE = 8VIDEO_PATH = "demo.avi"
AUDIO_PATH = None # Disable audio
CHAR_WIDTH = 150
FONT_SIZE = 6VIDEO_PATH = "hd_video.mp4"
AUDIO_PATH = "soundtrack.mp3"
CHAR_WIDTH = 200 # More characters = more detail
FONT_SIZE = 5 # Smaller font = higher resolution- Frame Rate: ~24-30 FPS for 100-char width
- Latency: <50ms frame processing time
- Memory: ~100-200MB depending on video resolution
- Scalability: Handles videos up to 1080p efficiently
This project demonstrates:
- โ Real-time video processing with OpenCV
- โ ASCII rendering algorithms
- โ Multimedia synchronization techniques
- โ Structuring Python projects for GitHub
- โ Performance optimization for real-time applications
- โ Integration of multiple Python libraries
- Frame-rate adaptive rendering for smoother playback
- Terminal-based (CLI) ASCII output for cross-platform compatibility
- Color ASCII mode using ANSI color codes
- Performance optimizations for 4K videos
- Interactive controls (play/pause/seek)
- Multiple character set options for different styles
- Export to text file feature
- Unit tests and CI integration
- GUI configuration panel
- High resolution videos may cause frame drops
- Audio sync may drift on slower systems
- Some video codecs require additional dependencies
Contributions are welcome! Here's how you can help:
- Fork the repository
- Create your feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
This project is licensed under the MIT License.
MIT License
Copyright (c) 2025 Aryan Ranjan
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software.
Free to use, modify, and distribute.
- OpenCV community for computer vision tools
- Pygame development team
- ASCII art community for inspiration
โก "The art challenges the technology, and the technology inspires the art." - John Lasseter
Made with โค๏ธ by Aryan Ranjan | Star โญ this repo if you found it helpful!