Name by the awesome @tbodt
Are you a terminal fanboy like me?
Sure, but do you ever watch YouTube? In your terminal?
termplay
is the tool to convert images to ANSI sequences.
But it also supports playing videos... and YouTube...
Written in the systems language Rust, it has some solid performance.
When playing a video:
- Concurrency
- It's converting to ANSI while ffmpeg
is still processing!
- Audio/Frame Sync
- If one frame in takes longer to load and the audio continues on,
- don't just pretend nothing happened! Skip a few frames!
- Get back on track!
Or if you want to maintain ratio
(Landscape image from pexels.com)
This tool is tested in GNOME Terminal, Konsole and alacritty (glitchy but amazing framerate).
Might not be fully or supported at all by whatever terminal you use.
```
termplay-image Convert a single image to text
USAGE:
termplay image [FLAGS] [OPTIONS]
FLAGS: -k, --keep-size Keep the frame size. Overrides -w and -h --help Prints help information -V, --version Prints version information
OPTIONS:
-w, --width
ARGS:
``` termplay-video Play a video in your terminal
USAGE: termplay video [FLAGS] [OPTIONS]
FLAGS: -k, --keep-size Keep the frame size. Overrides -w and -h --help Prints help information -V, --version Prints version information
OPTIONS:
-w, --width
ARGS:
Replace video
with ytdl
, and supply a URL as VIDEO, and boom!
Watch from YouTube directly!
Also has --format
(short -f
) to supply formats to youtube-dl to change quality and stuff.
If you feel like playing a video multiple times on the same settings,
you can pre-process a video.
That means doing all the processing part separately, so you can skip it if you do it multiple times.
Example:
```
$ termplay preprocess video.mp4
Checking ffmpeg... SUCCESS
Creating directory... Starting conversion: Video -> Image... Started new process. Converting: Image -> Text Processing frame622.png Seems like we have reached the end Converting: Video -> Music Number of frames: 621 $ termplay video termplay-video 621 # 'termplay-video' is the default name for the processed folder. ```
Fun fact:
If you change the rate, you have to do it on both while pre-processing and while playing.
Or... don't. And enjoy playing the video in fast or slow motion.
... That said, it comes with a slight flaw. For now, you have to compile this yourself.
Rust v1.18 or more is required. See your Rust version with
rustc --version
Update rust with
rustup update stable
To install termplay, you need anything ears requires.
Example:
On Ubuntu, you would run
sudo apt install libopenal-dev libsndfile1-dev
libsixel is ALWAYS needed (no matter if you use it or not). Example: sudo apt install libsixel
To use the video features, you need ffmpeg. Example: sudo apt install ffmpeg
To use the ytdl features, you need youtube-dl. Example: sudo -H pip install --upgrade youtube-dl
Other than that, this project is hosted on crates.io.
So to install you just need to run
cargo install termplay