Skip to content

Repository files navigation

SwiftVolcCaption

中文 · English

macOS 菜单栏工具:旁录系统正在播放的声音,实时生成双语字幕悬浮窗。 看外语直播、播客、会议录像时用。

A macOS menu-bar app that taps system audio and renders real-time bilingual subtitles in a floating overlay.

技术实现细节见 ARCHITECTURE.md · Implementation notes: ARCHITECTURE.md


中文

这是什么

在 Mac 上看外语内容时,把系统正在播放的声音实时转成「原文 + 译文」两行字幕, 显示在可拖动的悬浮窗里。

  • 不需要装 BlackHole 之类的虚拟声卡
  • 可以只抓某个 App 的声音,避免提示音、背景音乐混进字幕
  • 字幕可导出 .srt(带时间轴,能直接拖进播放器)和 .jsonl

识别与翻译由火山引擎完成,需要你自己的账号,按用量付费

系统要求

项目 要求
系统 macOS 14.4 或更高
芯片 Apple Silicon / Intel
账号 火山引擎账号,已开通同声传译服务
网络 能访问 openspeech.bytedance.com

第一步:准备火山引擎

本项目调用火山引擎(Volcengine)的同声传译服务,与字节跳动、火山引擎无任何隶属关系

开通与取 Key

  1. 登录火山引擎语音控制台
  2. 开通同声传译服务(需单独开通,否则没有配额)
  3. 在 API Key 管理页创建一个 Key
  4. 打开 App → 菜单栏图标 →「更多设置…」→「账号」→ 粘贴

Key 存在 macOS 钥匙串里,不写进任何明文文件。

费用

按 token 计量、随用随扣,单价以控制台为准。长时间使用会持续产生费用, 建议在控制台设置用量告警

本项目只用文本模式(不合成语音),所以语音合成那部分 token 恒为 0。

语种限制

支持 20 种语言 + 粤语/上海话,但有一条硬性约束:

源语言和目标语言之中,必须至少有一个是中文或英文。

「英语 → 中文」「日语 → 中文」「中文 → 英语」都行,「日语 → 韩语」不行。 设置界面会在组合非法时提示。方言只能作为源语言。

⚠️ 你的音频会被上传

启用字幕后,系统正在播放的音频会上传到火山引擎服务器做识别和翻译。

  • 音频会离开你的电脑,由 ByteDance 运营的服务处理
  • 若选择「全部系统声音」,那么期间所有出声的程序都会被一并上传—— 包括会议软件、通知音、私人语音消息
  • 本项目不在本地保存音频;服务端如何留存取决于火山引擎的政策, 参见其服务条款与隐私文档

处理敏感内容前请三思,并优先把「捕获来源」限定到具体的 App。

第二步:安装

方式一:下载现成的 App

Releases 下载 SwiftVolcCaption.zip,解压后拖进「应用程序」, 然后必须解除隔离标记(见下一节)。

方式二:从源码构建(更推荐)

不需要 Xcode,Command Line Tools 就够。但必须先创建一张自签名证书—— 没有它 App 能装能开,却永远录不到声音(系统会静默返回全零,不报任何错)。

xcode-select --install     # 装过就跳过

# 创建自签名的代码签名证书
cat > /tmp/svc.conf <<'EOF'
[ req ]
distinguished_name = dn
x509_extensions = v3
prompt = no
[ dn ]
CN = SwiftVolcCaption Dev
[ v3 ]
basicConstraints=critical,CA:false
keyUsage=critical,digitalSignature
extendedKeyUsage=critical,codeSigning
EOF
openssl req -x509 -newkey rsa:2048 -nodes -days 3650 \
  -keyout /tmp/svc-key.pem -out /tmp/svc-cert.pem -config /tmp/svc.conf

# key 和证书要分开导入(打包成 .p12 会因加密方式不兼容而失败)
security import /tmp/svc-key.pem  -k ~/Library/Keychains/login.keychain-db -T /usr/bin/codesign
security import /tmp/svc-cert.pem -k ~/Library/Keychains/login.keychain-db -T /usr/bin/codesign
security add-trusted-cert -r trustRoot -p codeSign \
  -k ~/Library/Keychains/login.keychain-db /tmp/svc-cert.pem

# 构建并安装到 /Applications
git clone https://github.com/aronnaxlin/SwiftVolcCaption.git
cd SwiftVolcCaption && ./install.sh

打不开?提示「已损坏,应该移到废纸篓」?

App 没有损坏。 这是 macOS 对未经 Apple 公证程序的统一提示。 本项目没有公证,因为那需要每年 99 美元的开发者账号。

解除隔离标记即可:

xattr -dr com.apple.quarantine /Applications/SwiftVolcCaption.app

然后正常双击打开。若仍被拦,可以在「访达」里右键点 App → 打开, 或到「系统设置 → 隐私与安全性」,页面下方会出现「仍要打开」。

能打开但一直收不到音频? Release 里的 App 是用作者机器上的自签名证书签的, 那张证书在你电脑上不受信任,macOS 的录音权限可能因此不肯授权。 遇到这种情况请改用方式二从源码构建,用你自己的签名身份就没有这个问题。

第三步:使用

  1. 菜单栏点字幕气泡图标 →「开始字幕」,或按全局快捷键 ⌃⌥S
  2. 首次运行会请求「录制此电脑上的音频」权限,必须允许
  3. 播放外语内容,字幕出现在屏幕底部

⚠️ 要从「访达」或 Launchpad 启动,不要在终端里直接运行二进制。 从终端启动的话系统会把录音权限算在终端头上,App 拿不到授权、 且静默返回全零不报错

菜单里可直接切换:捕获来源、样式预设、字号、最多显示行数、显示/隐藏悬浮窗、导出字幕。

设置

「更多设置…」分五页:

内容
通用 API Key、源语言、目标语言
字幕样式 预设、字体、字号、加粗斜体、文字颜色
描边与阴影 描边开关/颜色/粗细、阴影、背景框
排版 对齐、字幕框宽度、显示行数、间距、放回默认位置
快捷键 全局快捷键、自动显示悬浮窗、停止时自动导出

样式页顶部有实时预览,衬在明暗渐变上——描边和透明度要在深浅两种底色上都看得清才有意义。

已知限制

  • 只支持 macOS 14.4+
  • 没有公证,需手动解除隔离标记
  • 源/目标语言必须有一个是中文或英文
  • 断线重连期间的音频会被丢弃而非补发(补发会让字幕越来越落后于画面)

隐私

API Key 存在钥匙串;音频不在本地保存,但会上传到火山引擎服务器(见上文)。 导出的字幕写在 ~/Documents/SwiftVolcCaption/

许可证

MIT。本项目与字节跳动、火山引擎无隶属关系,也未获其背书。 「火山引擎」「豆包」等商标归各自所有者所有。


English

What it is

Turns whatever your Mac is currently playing into two-line subtitles — original on top, translation below — in a draggable floating overlay.

  • No virtual audio driver (BlackHole etc.) needed
  • Can capture a single app, keeping notification chimes out of your subtitles
  • Export subtitles as .srt (with timecodes) and .jsonl

Recognition and translation run on Volcengine. You need your own account and it is billed by usage.

Requirements

Item Requirement
OS macOS 14.4 or later
Chip Apple Silicon / Intel
Account Volcengine account with simultaneous interpretation enabled
Network Access to openspeech.bytedance.com

Step 1 — set up Volcengine

This project calls Volcengine's simultaneous interpretation service. It is not affiliated with or endorsed by ByteDance or Volcengine.

Enable the service and get a key

  1. Sign in to the Volcengine speech console
  2. Enable simultaneous interpretation (must be enabled separately, or you get no quota)
  3. Create an API key on the key-management page
  4. In the app: menu-bar icon → More Settings…Account → paste it

The key is stored in the macOS Keychain, never in a plaintext file.

Cost

Billed per token, pay-as-you-go; see the console for current rates. Extended use accrues cost continuously — setting a usage alert in the console is strongly recommended.

This app only uses the text mode, so speech-synthesis tokens are always 0.

Language constraint

20 languages plus Cantonese/Shanghainese are supported, with one hard rule:

At least one of the source and target languages must be Chinese or English.

English → Chinese, Japanese → Chinese and Chinese → English all work; Japanese → Korean does not. The settings UI warns you on an invalid pair. Dialects can only be the source language.

⚠️ Your audio is uploaded

While captioning is active, the audio your system is playing is uploaded to Volcengine's servers for recognition and translation.

  • Audio leaves your machine and is processed by ByteDance-operated services
  • With All system audio selected, everything that makes a sound during that period is uploaded — conference calls, notification chimes, private voice messages
  • This project stores no audio locally; server-side retention is governed by Volcengine's policies, see their terms and privacy documentation

Think twice before captioning sensitive material, and prefer restricting the capture source to a specific app.

Step 2 — install

Option 1 — download a prebuilt app

Get SwiftVolcCaption.zip from Releases, unzip, drag into /Applications, then clear the quarantine flag (see next section).

Option 2 — build from source (recommended)

Xcode is not required — Command Line Tools suffice. But you must create a self-signed certificate first: without one the app installs and launches fine yet never records anything (macOS silently returns all-zero samples, with no error).

xcode-select --install     # skip if already installed

# Create a self-signed code-signing certificate
cat > /tmp/svc.conf <<'EOF'
[ req ]
distinguished_name = dn
x509_extensions = v3
prompt = no
[ dn ]
CN = SwiftVolcCaption Dev
[ v3 ]
basicConstraints=critical,CA:false
keyUsage=critical,digitalSignature
extendedKeyUsage=critical,codeSigning
EOF
openssl req -x509 -newkey rsa:2048 -nodes -days 3650 \
  -keyout /tmp/svc-key.pem -out /tmp/svc-cert.pem -config /tmp/svc.conf

# Import key and certificate separately (bundling into a .p12 fails —
# macOS cannot read OpenSSL 3.x's default encryption)
security import /tmp/svc-key.pem  -k ~/Library/Keychains/login.keychain-db -T /usr/bin/codesign
security import /tmp/svc-cert.pem -k ~/Library/Keychains/login.keychain-db -T /usr/bin/codesign
security add-trusted-cert -r trustRoot -p codeSign \
  -k ~/Library/Keychains/login.keychain-db /tmp/svc-cert.pem

# Build and install into /Applications
git clone https://github.com/aronnaxlin/SwiftVolcCaption.git
cd SwiftVolcCaption && ./install.sh

"App is damaged and can't be opened"?

The app is not damaged. That is macOS's generic message for software that is not notarized by Apple. This project is not notarized, as that requires a $99/year developer account.

Clear the quarantine flag:

xattr -dr com.apple.quarantine /Applications/SwiftVolcCaption.app

Then open it normally. If still blocked, right-click the app in Finder → Open, or go to System Settings → Privacy & Security where an "Open Anyway" button appears.

Opens but never receives audio? The Release build is signed with a self-signed certificate that exists only on the author's machine and is not trusted on yours, so macOS may refuse to grant recording permission. In that case build from source (Option 2) — with your own signing identity the problem does not arise.

Step 3 — use it

  1. Click the caption-bubble icon in the menu bar → Start captions, or press ⌃⌥S
  2. On first run macOS asks to record this computer's audio — you must allow it
  3. Play something in a foreign language; subtitles appear near the bottom of the screen

⚠️ Launch it from Finder or Launchpad, not by running the binary from a terminal. Launched from a terminal, macOS attributes the recording permission to the terminal app; yours never gets it and capture silently returns all zeros with no error.

The menu exposes: capture source, style presets, font size, max visible lines, show/hide overlay, and subtitle export.

Settings

More Settings… has five panes:

Pane Contents
General API key, source language, target language
Subtitle style Presets, font, size, bold/italic, text colours
Outline & shadow Outline toggle/colour/width, shadow, background box
Layout Alignment, overlay width, visible lines, spacing, reset position
Hotkey Global hotkey, auto-show overlay, auto-export on stop

The style panes carry a live preview over a light-to-dark gradient — outline and opacity only matter if they hold up against both bright and dark backgrounds.

Known limitations

  • macOS 14.4+ only
  • Not notarized; the quarantine flag must be cleared manually
  • One of source/target language must be Chinese or English
  • Audio captured during a reconnect is dropped rather than buffered (replaying it would make subtitles drift further behind the picture)

Privacy

The API key lives in the Keychain. Audio is not stored locally but is uploaded to Volcengine servers (see above). Exported subtitles are written to ~/Documents/SwiftVolcCaption/.

License

MIT. Not affiliated with or endorsed by ByteDance or Volcengine. "Volcengine", "Doubao" and related marks belong to their respective owners.

About

macOS 菜单栏工具:旁录系统音频,用火山引擎同声传译实时生成双语字幕悬浮窗 · Live bilingual subtitles for macOS, powered by Volcengine

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages