Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

RH-Translation

实时把日语视频/网页音频翻成中文字幕的 macOS 菜单栏小工具。捕获系统正在播放的声音 → 端上日语语音识别 → 日译中 → 屏幕底部悬浮字幕。本地识别、无需登录。

RH-Translation is a macOS menu bar app that turns any Japanese audio playing on your Mac into real-time Chinese subtitles: it captures system audio (Core Audio process tap, no screen-recording permission), transcribes Japanese speech on-device (Apple SpeechAnalyzer or local whisper.cpp), translates Japanese → Chinese (free Google endpoint or local llama.cpp), and shows a draggable always-on-top floating subtitle overlay. Works with any video player or browser. macOS 26+, Apple Silicon. (UI is currently Chinese-only.)

  • 🎧 抓系统音频:基于 Core Audio 进程 Tap,无需屏幕录制权限、无录屏指示灯;可选「全系统」或「指定浏览器」。
  • 🗣 两种识别引擎:macOS 内置语音识别(流式、零配置,首次自动下载日语模型)/ 本地 whisper.cpp(嘈杂、多人对话场景更准,需额外安装,见下文)。
  • 🌐 两种翻译后端:Google 免费端点(开箱即用)/ 本地 llama.cpp(离线、可定制提示词)。
  • 💬 悬浮字幕:置顶半透明、可拖动、可调字号/透明度、可点击穿透。

系统要求

  • macOS 26+
  • Apple 芯片(M 系列)

安装

  1. Releases 下载 RH-Translation.dmg
  2. 双击挂载,把 RH-Translation.app 拖进 Applications。
  3. 首次打开若提示「无法打开 / 已损坏」(因为是免费分发、未经 Apple 公证),在终端运行一次:
    xattr -dr com.apple.quarantine /Applications/RH-Translation.app
    或:系统设置 → 隐私与安全性 → 「仍要打开」。
  4. 首次启动会请求音频捕获语音识别权限,允许即可。

使用

  • App 在菜单栏(无 Dock 图标)。点图标 → 「开始翻译」(快捷键 T)。
  • 字幕出现在屏幕底部,可拖动到任意位置。
  • 设置(⌘,)里可切换识别引擎、翻译后端、音频源、字号/透明度、是否显示日文原文、模型与提示词等。

用 whisper 识别引擎(可选,嘈杂/多人场景更准)

默认的 Apple 识别引擎零配置,但对多人同时说话、背景音乐重、气声/耳语的场景容易识别不出。 选 whisper 引擎前需要提前装两样东西

  1. 安装 whisper.cpp(提供 whisper-server 命令):
    brew install whisper-cpp
  2. 下载识别模型(推荐 large-v3-turbo,约 1.6GB,速度/质量平衡最好):
    mkdir -p ~/models
    curl -L -o ~/models/ggml-large-v3-turbo.bin \
      https://huggingface.co/ggerganov/whisper.cpp/resolve/main/ggml-large-v3-turbo.bin
  3. 设置 → 通用 → 语音识别 → 识别引擎选「whisper-server」。模型文件默认路径就是 ~/models/ggml-large-v3-turbo.bin,放在别处的话点「选择…」指一下。

之后点「开始翻译」,App 会自动启动并管理 whisper-server(首次加载模型约十几秒,状态栏有提示; App 退出时自动关闭)。也可以在设置里手动启停,或自己在终端跑:

whisper-server -m ~/models/ggml-large-v3-turbo.bin -l ja --port 8090

注意:默认端口 8090(8080 常被 llama-server 占用);排查日志在 ~/Library/Logs/RH-Translation/whisper-server.log。 whisper 引擎按整句出字(说话中约每秒滚动刷新一次),比 Apple 引擎的逐字流式稍有延迟,换来更强的抗噪能力。

用 llama.cpp 翻译后端(可选,离线)

  1. 安装 llama.cppbrew install llama.cpp)并准备一个 GGUF 模型。
  2. 启动服务:llama-server -m 模型.gguf(默认监听 http://127.0.0.1:8080)。
  3. 设置里翻译后端选「llama.cpp 本地」,点「刷新模型」选中已加载的模型即可。

从源码构建

./build.sh                 # 生成 RH-Translation.app 与 RH-Translation.dmg(release + ad-hoc 签名)
open RH-Translation.app

本地编译出的 app 不带隔离标记,可直接运行,无需上面的 xattr 步骤。 若遇到 SwiftShims / module cache 报错(多因移动过目录),rm -rf .build 后重编。

详细架构与开发说明见 CLAUDE.md

隐私

音频捕获、语音识别(Apple 与 whisper 两种引擎)均在本机完成,音频不出网。使用 Google 翻译后端时,仅把识别出的日文文本发往 Google 翻译端点;使用 llama.cpp 后端则完全本地、不出网。

平台

  • macOS(主):Sources/RHTranslation/(SwiftPM + SwiftUI/AppKit)
  • Windows(早期移植,开发中):windows/RH-Translation/(.NET 10 + WPF)

English summary

Live Japanese-to-Chinese subtitles for macOS — a lightweight menu bar utility for watching Japanese videos, streams, or any web page with real-time translated captions.

  • System audio capture via Core Audio process taps: no screen-recording permission, no recording indicator; capture the whole system or a single browser (Chrome / Safari / Edge / Firefox / Arc / Brave).
  • On-device Japanese speech recognition: streaming Apple SpeechAnalyzer (zero setup) or a local whisper.cpp whisper-server (better accuracy for noisy audio, background music, and multi-speaker dialogue; the app launches and manages the server for you).
  • Translation backends: free Google Translate endpoint out of the box, or a fully offline local llama.cpp server with customizable prompts and rolling conversation context.
  • Floating subtitle overlay: always on top, translucent, draggable, click-through, adjustable font size / opacity / lines, optional Japanese original text, auto-hide on silence.
  • Privacy-friendly: audio never leaves your Mac; with the llama.cpp backend nothing goes online at all.

Requirements: macOS 26 or later, Apple Silicon. Download the DMG from Releases.

许可

个人项目。

About

macOS 菜单栏实时日译中字幕:捕获系统音频 → 端上日语语音识别(Apple Speech / whisper.cpp)→ 悬浮中文字幕。Real-time Japanese to Chinese live subtitles for any audio playing on your Mac. On-device ASR, Google / local llama.cpp translation.

Topics

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages