An ASCII video player that takes a video file, extracts its frames, converts them to ASCII art, and plays the video in the terminal, synchronized with audio playback.
- Converts video frames to ASCII art and displays them in the terminal.
- Synchronizes audio playback with the video frames.
- Supports frame rate detection and automatic synchronization with the terminal’s width and height.
- Extracts audio and plays it alongside the ASCII video using
pygame. - Uses
ffmpegto extract frames and audio from the input video.
To run the ASCII video player, you need the following dependencies:
imageioimageio-ffmpegPillowpygamecurses(built-in on Unix systems,windows-curseson Windows)
You can install the required dependencies using pip:
pip install imageio imageio-ffmpeg pygame PillowFor Windows users, install windows-curses:
pip install windows-cursesMake sure you have ffmpeg installed on your system for frame and audio extraction.
-
On Ubuntu:
sudo apt install ffmpeg
-
On macOS:
brew install ffmpeg
-
On Windows, download from ffmpeg.org and ensure it is added to your
PATH.
To run the program, you need to provide the path to a video file. The program will extract frames, convert them to ASCII, and synchronize with audio playback.
Example usage:
python main.py <path_to_video.mp4>video_path: The path to the input video file.width: The desired width of the terminal (default: terminal width).height: The desired height of the terminal (default: terminal height).fps: The frames per second (FPS) to synchronize the video with.audio: A boolean flag to enable or disable audio playback (default:True).
python main.py your_video.mp4