Skip to content

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.

Notifications You must be signed in to change notification settings

aryan-r03/Real-Time-ASCII-Video-Player

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

8 Commits
ย 
ย 
ย 
ย 

Repository files navigation

๐Ÿ“บ ASCIImator โ€” Real-Time ASCII Video Player

Transform Videos into Live ASCII Art with Synchronized Audio

Python OpenCV Pygame

A Python-based multimedia application that converts video frames into real-time ASCII art with synchronized audio playback.


๐Ÿš€ Overview

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

โœจ Features

Video
Real-Time Conversion
Live video-to-ASCII rendering
Audio
Audio Sync
Optional synchronized playback
Render
Pygame Rendering
Smooth window-based display
Config
Customizable
Resolution & font control

Key Capabilities

  • ๐ŸŽž 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

๐Ÿ’ป Tech Stack

Python
Python 3.x
OpenCV
OpenCV
Pygame
Pygame
NumPy
NumPy

Libraries Used

  • opencv-python โ€“ Video capture and frame processing
  • pygame โ€“ Window rendering and audio playback
  • numpy โ€“ Efficient numerical operations

๐Ÿ“ Project Structure

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

โš™๏ธ Installation & Setup

1. Clone the Repository

git clone https://github.com/aryan-r03/ASCIImator.git
cd ASCIImator

2. (Optional) Create a Virtual Environment

Linux / macOS

python3 -m venv venv
source venv/bin/activate

Windows

python -m venv venv
venv\Scripts\activate

3. Install Dependencies

pip install -r requirements.txt

๐Ÿ“‹ Requirements

opencv-python>=4.5.0
pygame>=2.0.0
numpy>=1.19.0

๐ŸŽฎ Running the Application

Basic Usage

python app.py

The application will:

  1. Load the specified video file
  2. Initialize the Pygame window
  3. Start real-time ASCII conversion
  4. Play synchronized audio (if enabled)

๐ŸŽจ Customization

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

Configuration Options

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

๐Ÿง  How It Works

Step 1
Capture Frames
OpenCV video processing
Step 2
Resize & Convert
Grayscale transformation
Step 3
Pixel Mapping
Intensity to ASCII
Step 4
Render Display
Pygame window output
Step 5
Audio Sync
Synchronized playback

Algorithm Details

  1. Frame Capture: OpenCV reads video frames sequentially
  2. Preprocessing: Frames are resized and converted to grayscale
  3. ASCII Mapping: Pixel intensities (0-255) map to ASCII characters
  4. Rendering: Pygame displays the ASCII grid in real-time
  5. Synchronization: Audio playback matches video frame timing

ASCII Character Set

The conversion uses a gradient of characters based on visual density:

ASCII_CHARS = " .:-=+*#%@"
# Space (lightest) โ†’ @ (darkest)

๐ŸŽฌ Usage Examples

Example 1: Play with Audio

VIDEO_PATH = "my_video.mp4"
AUDIO_PATH = "my_audio.mp3"
CHAR_WIDTH = 120
FONT_SIZE = 8

Example 2: Silent Mode (No Audio)

VIDEO_PATH = "demo.avi"
AUDIO_PATH = None  # Disable audio
CHAR_WIDTH = 150
FONT_SIZE = 6

Example 3: High Detail Mode

VIDEO_PATH = "hd_video.mp4"
AUDIO_PATH = "soundtrack.mp3"
CHAR_WIDTH = 200   # More characters = more detail
FONT_SIZE = 5      # Smaller font = higher resolution

๐Ÿš€ Performance

  • 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

๐Ÿ“Œ Learning Outcomes

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

๐Ÿ”ฎ Future Improvements

  • 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

๐Ÿ› Known Issues

  • High resolution videos may cause frame drops
  • Audio sync may drift on slower systems
  • Some video codecs require additional dependencies

๐Ÿค Contributing

Contributions are welcome! Here's how you can help:

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/AmazingFeature)
  3. Commit your changes (git commit -m 'Add some AmazingFeature')
  4. Push to the branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

๐Ÿ“„ License

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.

Acknowledgments

  • OpenCV community for computer vision tools
  • Pygame development team
  • ASCII art community for inspiration

๐Ÿ“ง Contact

LinkedIn Email GitHub Instagram


Footer

โšก "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!

About

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.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages