一个终端 ASCII 媒体播放器。可以在终端中以 ASCII 形式直接查看图像、GIF、视频、网络摄像头、YouTube 等。
View images, videos (files or YouTube links), 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.
Table of Contents
mpv or vlc because they're too mainstream.This crate is still in early development, but it already has a lot of features. Here's a list of what it can or can't do:
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:
They can be simply installed on Linux with your package manager. See below for more details.
If you're on Linux (Ubuntu), you can install all dependencies with your package manager. First install Rust:
sudo apt install curl
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
Then install tplay's prerequisite dependencies:
sudo apt install libssl-dev ffmpeg libavfilter-dev libavdevice-dev libavformat-dev libavcodec-dev libswscale-dev libasound2-dev yt-dlp libmpv-dev clang
Minimal setup on macOS using Homebrew. Commands below set the needed env vars, run quick checks, then install.
# 1) Install dependencies
xcode-select -p >/dev/null 2>&1 || xcode-select --install
brew update
brew install pkg-config cmake ffmpeg yt-dlp mpv
# 2) Session-only exports so pkg-config can find FFmpeg
export PKG_CONFIG_PATH="$(brew --prefix)/lib/pkgconfig:$(brew --prefix)/share/pkgconfig:$(brew --prefix ffmpeg)/lib/pkgconfig:${PKG_CONFIG_PATH:-}"
# 3) Quick checks (should print versions)
pkg-config --modversion libavutil
# 4) Install / update
cargo install tplay # fresh install
# or
cargo install tplay --force # update existing
Troubleshooting (one-off FFmpeg selection):
If the FFmpeg check fails, point pkg-config at a specific Homebrew formula for this command only:
brew install ffmpeg@7
PKG_CONFIG_PATH="$(brew --prefix ffmpeg@7)/lib/pkgconfig:$PKG_CONFIG_PATH" cargo install tplay
The crate can run on Windows and all prerequisites (ffmpeg) can be installed with vcpkg. However, the installation/setup process is lengthy and prone to errors. Performance is also very poor. Save yourself a headache: use WSL and follow the Linux instructions.
You can install it on Arch Linux using aur by running the following commands (using paru):
paru -S tplay-git
With your contribution and support it can be made available on other distros as well :).
You can install the tplay command line tool by running the following command:
# Install the tplay command line tool
cargo install tplay
So that you can run it from anywhere as
tplay [options]
# Clone the repository
git clone https://github.com/maxcurzi/tplay.git
# Change to the project directory
cd tplay
# (optional) Build the project
cargo build --release
# (optional) Run the tests
cargo test
# Run the project (use --release for faster performance)
cargo run --release -- [options]
By default, the crate uses MPV (libmpv-dev) for audio playback and subtitles.
For MPV 0.34 instead of 0.35+:
cargo build --release --no-default-features --features mpv_0_34
Alternative rodio backend (no playback speed control or pitch preserving):
cargo build --release --no-default-features --features rodio_audio
tplay [options]
| Argument | Description |
|---|---|
media |
Name of the file or stream to be processed (required). |
-f, --fps |
Forces a specific frame rate (--fps 23.976). |
-c, --char-map |
Custom lookup character table to use for the output. |
-g, --gray |
Start in grayscale mode |
-w, --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. |
-a, --allow-frame-skip |
Experimental frame skip flag. Try to use it if the playback is too slow. |
-n, --new-lines |
Experimental flag. Adds newline and carriage return \n\r at the end of each line (except the last). Terminals wrap around and don't need new lines, but if you want to copy-paste the text outside the terminal you may want them. The output would be a single long string otherwise. Uses more CPU. |
-l, --loop-playback |
Loop video/gif forever (default: do not loop - play once) |
-x, --auto-exit |
Exit automatically when the media ends (default: keep displaying the last frame) |
-s, --stretch |
Stretch video to fill terminal (ignore aspect ratio) |
-b, --browser |
Browser passed to yt-dlp cookies-from-browser for YouTube (default: firefox; use none to disable). Supported browsers are: brave, chrome, chromium, edge, firefox, opera, safari, vivaldi, whale |
Substitute tplay with cargo run --release -- if you plan to run from source.
…
0-9 - change character mapspace - toggle pause/unpauseg - toggle grayscale/colorm - toggle mute/unmute← / → - seek backward/forward 5 seconds↑ / ↓ - increase/decrease the audio volumej / l - seek backward/forward 10 seconds[ / ] - decrease/increase playback speed by 0.25x, / . - decrease/increase playback speed by 0.1x (fine control)\ - reset playback speed to 1.0xc - cycle through subtitle tracksC (Shift+c) - toggle subtitles on/offq - quitSpeed range: 0.5x to 2.0x with pitch-preserving audio.
[ / ] - 0.25x adjustments, / . - 0.1x fine adjustments \ - reset to 1.0xNote: Requires MPV backend (default). Rodio backend does not support speed control.
Subtitles appear at the bottom of the terminal. Use c to cycle tracks and Shift+C to toggle visibility.
Note: Requires MPV backend (default). Rodio backend does not support subtitles.
-a / --allow-frame-skip flag.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. Some 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!
Thanks to the following people for their contributions and support:
暂无开放 Issues,或尚未同步最近议题。