• Stars
    star
    540
  • Rank 82,257 (Top 2 %)
  • Language
    Rust
  • License
    MIT License
  • Created over 7 years ago
  • Updated over 2 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

GitLab: https://gitlab.com/jD91mZM2/termplay

termplay

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...
Written in the systems language Rust, it has some solid performance.

  • Multiple modes
    • Sixels: Only supported by a few terminals, like xterm.
    • Unicode halfblock: This is the same as TrueColor below, but uses unicode half-blocks for smaller pixels.
    • TrueColor: Any RGB color, supported by most terminals.
    • 256 color: The closest representation of a color that can be fit within 1 byte. Use this if nothing else works.
  • Flexible
    • Change framerate, size and more using command line switches
  • Adapting size
    • Automatically scales the image to fit your terminal

Termplay also allows you to control the media, such as zoom in or pause the video.

  • Mouse Scroll / +/-: Zoom
  • Mouse Drag / W/A/S/D: Pan
  • Space: Play/Pause
  • Left/Right: Seek
  • Up/Down: Volume
  • q / Ctrl+C: Quit

Example image
(Landscape image from pexels.com)

Using

Image

termplay 2.0.0
jD91mZM2 <[email protected]>
Play images/videos in your terminal

USAGE:
    termplay [FLAGS] [OPTIONS] <path>

FLAGS:
        --help       Prints help information
    -q, --quiet      Ignores all the nice TUI things for simple image viewing
    -V, --version    Prints version information

OPTIONS:
    -c, --converter <converter>    Decides how the image should be displayed [default: halfblock]  [possible values:
                                   color256, halfblock, sixel, truecolor]
    -h, --height <height>          Sets the height (defaults to the terminal size, or 24)
    -r, --rate <rate>              Sets the framerate [default: 24]
        --ratio <ratio>            Sets the terminal font ratio (only takes effect with some converters)
    -w, --width <width>            Sets the width (defaults to the terminal size, or 80)

ARGS:
    <path>    Specifies the path to the image/video to play

Compiling

Compile time requirements

Rust v1.25 or more is required. See your Rust version with

rustc --version

Update rust with

rustup update stable

Compiling!

Other than that, this project is hosted on crates.io.
So to install you just need to run

cargo install termplay --features bin

(Note: The --features part is a hack because binaries don't allow specifying separate dependencies)

Features

Almost all dependencies are optional and can be disabled!

Default features:

  • termion: This is what enables the rich image viewer. Disabling this will disable almost everything.
  • gst: Video support, requires gstreamer
  • sixel: Support for sixels, requires libsixel

To disable default features, run

cargo install termplay --no-default-features --features "bin,..."

where ... is a comma separated list of features you want to keep.

Nix

Termplay is available with the default features on Nix!

nix-env -iA nixpkgs.termplay

Arch Linux

If you just want to get this running on Arch Linux with the default features, you can use the
AUR Package (unofficial)

Debian / Ubuntu

Example:

sudo apt install libopenal-dev libsndfile1-dev libsixel-dev libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev libgstreamer-plugins-bad1.0-dev
cargo install termplay --features bin

More Repositories

1

xidlehook

GitLab: https://gitlab.com/jD91mZM2/xidlehook
Rust
382
star
2

powerline-rs

GitLab: https://gitlab.com/jD91mZM2/powerline-rs
Nix
117
star
3

sslhash

SSL without a certificate authority
Rust
31
star
4

jrust

A Rust macro that parses Java-like syntax and runs it as a Rust program
Rust
27
star
5

dotfiles

Literally just my "dotfiles" (except most don't even have dots in front of them). Not interesting, but 'kay.
Nix
25
star
6

rot26

Pure rust implementation of the rot26 algorithm
Rust
24
star
7

Jointercept

Jointercept stands for Join Intercept and is a replacement for the buggy EventGhost to instead launch your own programs!
Go
19
star
8

rust-lci

A LOLCODE interpreter written in Rust
Rust
15
star
9

rust-import

Attempt at an importer for Rust
Rust
11
star
10

minttp

minttp is an experiment to see if I could create a simple and minimal HTTP library without any dependencies.
Rust
11
star
11

chess-minimax

A chess bot written in Rust using the minimax algorithm
Rust
7
star
12

UndertaleSandbox

Backup your Undertale save files and replace them with new ones temporarily.
Go
7
star
13

insult

"Oh... Sir! The Insult Simulator" - like insults.
Rust
5
star
14

docker-steam

Very simple steam docker image (entirely thanks to x11docker)
Shell
5
star
15

git-subcopy

Link files across repositories
Nix
4
star
16

no-std-compat

A `#![no_std]` compatibility layer that will make porting your crate to no_std *easy*.
Rust
4
star
17

TimeyWimey-Go

No more stuggle with time zones... Thanks Discord!
Go
3
star
18

Join-API-for-Java

Access the Join API simply via Java
Java
2
star
19

termwm

A floating WM of terminals inside your terminal
Rust
2
star
20

pseudoterm

Low-level library for creating PTYs and getting related properties
Rust
2
star
21

spell

Tries to find the word you are looking for and spell it correctly
Rust
2
star
22

DA-DANK-MEEMZ

IT US DANK MEEMZ ONLEIN 2 GIV U AUDIO AND JPEGZ. INVEIT 2 UR DISCORD SERVR 4 MAXIMUM DANKNEZZZ
Go
2
star
23

docker-compiler-explorer

WIP Dockerfile to run compiler explorer locally
Dockerfile
2
star
24

rowan-tools

A few helpers for writing hand-written parsers (Mirror)
Rust
2
star
25

lcs

A project aimed to teach me how to calculate diffs
Rust
1
star
26

cargo-patch

A WIP cargo subcommand for recursively patching dependencies without [patch]
Rust
1
star
27

MCWASM

Mirror from GitLab
Python
1
star
28

math-types

A simple library for a few math types, such as fractions and matrices.
Rust
1
star
29

easyfuse

A high-level idiomatic wrapper around rust-fuse
Rust
1
star
30

configfs

Crazy project that creates a virtual filesystem to translate your config files
Rust
1
star
31

nix-github

Nix Flake action for GitHub
Shell
1
star
32

remoterm

SSH-like application for remote support
Rust
1
star