Movycat – 用 Zig 编写的终端电影播放器
Movycat – A terminal movie player written in Zig

原始链接: https://github.com/M64GitHub/movycat

## movycat:终端视频播放器 movycat 是一个基于终端的视频播放器,使用 Zig 编写,利用 FFmpeg 进行解码,并使用 SDL2 实现同步音频。它使用全 RGB 颜色和 ANSI 半块字符,可在终端内直接播放多种视频格式(如 .mp4、.mkv、.webm)。 用户可以使用键盘快捷键控制播放:ESC 退出,SPACE 暂停,光标/vim 键用于搜索。可以通过 'i' 切换信息叠加层。可以指定输出尺寸,并在终端大小内保持纵横比。 movycat 既是“movy”渲染引擎能力的演示——展示实时视觉效果,也是 Zig 能够与 FFmpeg 和 SDL2 等库无缝集成的实用应用。目前已在 macOS 和 Ubuntu 上测试过。

## Movycat:用Zig编写的终端电影播放器 一个名为**Movycat**的新型终端电影播放器,使用Zig编程语言编写,在Zigtoberfest上的演示后备受关注。它由Mario开发,并伴随着相关项目,如终端图形库(**movy**)、Commodore 64模拟器(**zig64 & zigreSID**)和C64游戏(**1st-shot**)。Movycat使用ANSI半块字符渲染视频帧。 讨论的重点在于*Movycat如何*实现其分辨率和色彩输出,并与现有方法(如sixels和`mpv`的终端输出选项)进行比较。用户对终端内更高级图形的可能性感到兴奋。另一些人则将作者的C64模拟工作视为在低功耗硬件上运行经典游戏的一种潜在解决方案。该项目展示了令人印象深刻的技术能力以及在现代编程语言中对复古计算的奉献精神。
相关文章

原文

License Version Zig

get_movycat5

movycat plays videos directly in your terminal — in full RGB color. It renders frames as ANSI half block characters, using the movy rendering engine, with synced audio playback powered by SDL2.

It supports all formats that FFmpeg can decode — including .mp4, .h264, .avi, .mkv, .webm, and more.

Usage:

movycat -f|-file <filename> 
        [-w|-width <width>]
        [-h |-height <height>]
        [-a]

movycat -help

Options:
       -f ............ File to play

       -w, -h ........ Optional: dimensions of video output in pixels.
                       The resulting output size always preserves the 
                       aspect ratio, and is truncated to the terminal
                       size.

       -a ............ Optional: show video on alternate screen.
                       This preserves your current terminal state.

       -help ......... Help. Show this help along with the movycat
                       logo.
  • Press ESC to quit.

  • Press SPACE to pause.

  • Press CURSOR RIGHT to skip forward 5 seconds.

  • Press CURSOR LEFT to skip backwards 5 seconds.

  • Of course you can use vim keys instead of the cursor keys!
    l to skip forwards, and h to skip backwards 5 seconds.

  • Press i to toggle the info overlay.

2025-06-26_23-54-17.mp4

(Excerpt from the 64k Demo "Universal Sequence" from the amazing demo group "Conspiracy")

image

image

movycat is both a demo and a showcase of what movy can do: an RGBA-based rendering engine for composing, transforming, and displaying visuals with real-time effects. If movy can render anything to a surface, why not video frames?

movycat is entirely written in Zig. This offers us to seamlessly import libffmpeg. And libsdl2. And call it directly from the code.

  • FFmpeg (shared libraries)
  • SDL2
  • Zig 0.15.2 or newer

movycat has been tested and confirmed working on:

  • macOS 15.5 with FFmpeg 8.0 (via Homebrew)
  • Ubuntu 25.10 with FFmpeg 7.1.1 (via apt)

On macOS:

On Ubuntu:

sudo apt install libavformat-dev libavcodec-dev libavutil-dev libswscale-dev libswresample-dev libsdl2-dev
联系我们 contact @ memedata.com