16 个稳定版本
使用旧的 Rust 2015
2.0.6 | 2020年1月7日 |
---|---|
2.0.5 | 2018年5月31日 |
2.0.2 | 2018年4月11日 |
1.3.0 | 2018年1月9日 |
0.1.1 | 2017年6月22日 |
#116 in 视频
每月 25 次下载
45KB
1K SLoC
termplay
名字来源于 @tbodt
你像我一样是终端爱好者吗?
当然,但你有没有在终端看过 YouTube?
termplay
是将图像转换为 ANSI 序列的工具。
但它也支持播放视频...
用系统语言 Rust 编写,具有出色的性能。
- 多种模式
- 像素块:仅由少数终端支持,如 xterm。
- Unicode 半块:这与下面的真彩色相同,但使用 Unicode 半块来表示更小的像素。
- 真彩色:任何 RGB 颜色,大多数终端都支持。
- 256 种颜色:可以适应 1 个字节的颜色的最接近表示。如果其他方法都不行,请使用此方法。
- 灵活
- 使用命令行开关更改帧率、大小等
- 自适应大小
- 自动将图像缩放到适合您的终端
Termplay 还允许您控制媒体,例如放大或暂停视频。
- 鼠标滚轮 / +/-:放大
- 鼠标拖动 / W/A/S/D:平移
- 空格:播放/暂停
- 左右键:快进/快退
- 上下键:音量
- q / Ctrl+C:退出
(风景图片来自 pexels.com)
使用
图像
termplay 2.0.0
jD91mZM2 <me@krake.one>
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
编译
编译时间要求
Rust v1.25 或更高版本 是必需的。使用以下命令查看您的 Rust 版本:
rustc --version
更新 rust:
rustup update stable
编译!
除此之外,该项目托管在 crates.io 上。
因此,要安装,您只需运行:
cargo install termplay --features bin
(注意:--features
部分是一个技巧,因为二进制文件不允许指定单独的依赖项)
功能
几乎所有依赖项都是可选的,可以禁用!
默认功能
要禁用默认功能,请运行
cargo install termplay --no-default-features --features "bin,..."
其中 ...
是您希望保留的功能的逗号分隔列表。
Nix
Termplay 在 Nix 上默认启用所有功能!
nix-env -iA nixpkgs.termplay
Arch Linux
如果您只想在 Arch Linux 上使用默认功能运行此软件,可以使用
AUR 包(非官方)
Ubuntu
示例
sudo apt install libopenal-dev libsndfile1-dev libsixel-dev gstreamer1.0-dev gstreamer-plugins-base1.0-dev gstreamer1.0-plugins-base gstreamer-plugins-bad1.0-dev gstreamer1.0-plugins-bad
cargo install termplay --features bin
依赖项
~14MB
~110K SLoC