View images, videos, webcam, etc directly in the terminal as ASCII. All images you see below are just made by characters on the terminal command line, drawn really fast.
mpv
or vlc
because they're too mainstream.These instructions will get you a copy of the project up and running on your local machine for development and testing purposes.
Being a Rust crate, you will need to have Rust installed on your system. You can find the installation instructions here.
The following dependencies are also required:
OpenCV 4
If you have troubles in Windows (I know I have) try this (assuming you have a relatively modern computer with a Windows 64bit installation):
- Using vcpkg: .\vcpkg install opencv4[contrib,nonfree] --triplet x64-windows
from an administrator powershell within the vcpkg directory.
- Then, install LLVM from binary, you'll likely want to use the 64-bit version on a modern computer.
- Make sure that the environment variable OPENCVLINKLIBS is set to just opencv_core4
.
Optional dependency for YouTube support: yt-dlp
You may need to install the following packages on some Linux distributions:
libssl-dev
(to run tests)
libopencv-dev
libstdc++-12-dev
gstreamer1.0-plugins-good gstreamer1.0-plugins-bad gstreamer1.0-plugins-ugly
clang libclang-dev
A step-by-step guide on how to set up the project for development or usage.
```bash
git clone https://github.com/maxcurzi/tplay.git
cd tplay
cargo build
cargo test
cargo run --release --
You can install the tplay
command line tool by running the following command:
```bash
cargo install tplay
So that you can run it from anywhere as
bash
tplay
tplay <media> [options]
| Argument | Description |
|--------|-------------|
| media
| Name of the file or stream to be processed (required). |
| -f
, --fps
| Maximum frames per second for the output (default: 60). |
| -c
, --char_map
| Custom lookup character table to use for the output (default: .:-=+*#%@
). |
| -g
, --gray
| Start in grayscale mode |
| --w_mod
| Experimental width modifier for certain characters such as emojis (default: 1). Use a value of 2 if your char_map is composed of emojis. |
```bash
cargo run --release --
if you didn't install it as tplay)tplay
tplay ./image.png
tplay ./image.gif
tplay ./video.mp4 --fps 60
tplay https://www.youtube.com/watch?v=dQw4w9WgXcQ --fps 30
tplay http://media.developer.dolby.com/Atmos/MP4/shattered-3Mb.mp4 --fps 30
tplay https://www.youtube.com/watch?v=fShlVhCfHig --fps 30 --char-map " ░▒▓█"
tplay https://www.youtube.com/watch?v=FtutLA63Cp8 --fps 30 --char-map "🍎🍏❤️😊" --w-mod 2
tplay /dev/video0 --fps 30 ```
space
- pause/unpauseq
- quit0-9
- change char mapg
- toggle grayscale/colorfps
value, increase font size, or reduce the terminal window size.This is my ASCII media player: there are many like it, but this one is mine.
For other ASCII media players, check out: https://github.com/search?q=ascii+player&type=repositories
Contributions are welcome! Please open an issue or submit a pull request. Ideally I'd like to implement the following features: - Sound playback (both audio track of videos and audio files) - More media controls (forward, backward, loop, etc.) - Any suggestions to improve the installation experience on Windows (Installing and setting up OpenCV is non-trivial)
Let me know if you have any other ideas!
This project is licensed under the MIT License - see the LICENSE file for details.
Your Scientists Were So Preoccupied With Whether Or Not They Could, They Didn’t Stop To Think If They Should
Mostly did it for fun while learning Rust. I also wanted to see if it was possible to make a video player that could run in the terminal. I think it's pretty cool that you can play videos in the terminal now. I hope you enjoy it too!