在 CentOS 中,cmatrix 本身只是个终端字符动画程序,不能录屏,需要借助终端录屏工具来录制 cmatrix 的运行画面。
下面给你几种在 CentOS 上常用、可行的方法(从简单到专业)。
script + scriptreplay(系统自带)适合录制成文本回放,不是视频,但最轻量。
script -c "cmatrix" cmatrix.log
播放:
scriptreplay cmatrix.log
✅ 优点
❌ 缺点
asciinema(终端录像,可分享)适合生成网页可播放的终端录像
sudo yum install epel-release -y
sudo yum install asciinema -y
asciinema rec cmatrix.cast
cmatrix
# 按 Ctrl+D 结束
asciinema play cmatrix.cast
✅ 可上传 asciinema.org
❌ 不是 mp4 视频
ffmpeg + X11 抓取(推荐)适合 CentOS 有桌面环境(GNOME / KDE)
sudo yum install epel-release -y
sudo yum install ffmpeg -y
ffmpeg -f x11grab -s 1920x1080 -i :0.0 -r 30 cmatrix.mp4
然后运行:
cmatrix
结束录制:Ctrl + C
✅ 真视频
❌ 需要桌面环境
recordmydesktop(GUI 录屏)sudo yum install recordmydesktop -y
recordmydesktop
如果你是 纯命令行服务器:
✅ 最佳方案:
asciinema(推荐)script❌ ffmpeg 不适用(没有 X11)
| 场景 | 推荐 |
|---|---|
| 服务器展示 | asciinema |
| 本地桌面 | ffmpeg |
| 只是演示 | script |
| 发布视频 | ffmpeg |
如果你愿意,可以告诉我:
我可以直接给你一条能用的命令。