{"id":50926174,"url":"https://github.com/strepto42/virtual-ac3-encoder","last_synced_at":"2026-06-16T23:04:09.736Z","repository":{"id":363202482,"uuid":"1261827119","full_name":"strepto42/virtual-ac3-encoder","owner":"strepto42","description":"Software Dolby Digital Live / DTS Connect-style encoder for Windows: a virtual 5.1 audio device that encodes any multichannel PCM to AC3 (Dolby Digital) in real time and streams it over S/PDIF (Toslink/optical) to an AV receiver. FFmpeg AC3 + WASAPI exclusive passthrough; a SoundPusher-for-Windows approach.","archived":false,"fork":false,"pushed_at":"2026-06-07T21:07:31.000Z","size":229,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-06-07T23:10:36.878Z","etag":null,"topics":["ac3","audio","dolby-digital","dolby-digital-live","dts","dts-connect","dtsconnect","ffmpeg","htpc","iec61937","kernel-driver","optical-audio","real-time-encoding","soundpusher","spdif","surround-sound","toslink","virtual-audio-device","wasapi","windows"],"latest_commit_sha":null,"homepage":null,"language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/strepto42.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":"NOTICE.md","maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-06-07T07:47:12.000Z","updated_at":"2026-06-07T21:05:54.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/strepto42/virtual-ac3-encoder","commit_stats":null,"previous_names":["strepto42/virtual-ac3-encoder"],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/strepto42/virtual-ac3-encoder","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/strepto42%2Fvirtual-ac3-encoder","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/strepto42%2Fvirtual-ac3-encoder/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/strepto42%2Fvirtual-ac3-encoder/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/strepto42%2Fvirtual-ac3-encoder/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/strepto42","download_url":"https://codeload.github.com/strepto42/virtual-ac3-encoder/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/strepto42%2Fvirtual-ac3-encoder/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34426758,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-16T02:00:06.860Z","response_time":126,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ac3","audio","dolby-digital","dolby-digital-live","dts","dts-connect","dtsconnect","ffmpeg","htpc","iec61937","kernel-driver","optical-audio","real-time-encoding","soundpusher","spdif","surround-sound","toslink","virtual-audio-device","wasapi","windows"],"created_at":"2026-06-16T23:04:09.030Z","updated_at":"2026-06-16T23:04:09.723Z","avatar_url":"https://github.com/strepto42.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# virtual-ac3-encoder\n\n[![CI](https://github.com/strepto42/virtual-ac3-encoder/actions/workflows/ci.yml/badge.svg)](https://github.com/strepto42/virtual-ac3-encoder/actions/workflows/ci.yml)\n\nA Windows 10/11 software implementation of **\"Dolby Digital Live\"**: a virtual 5.1 audio\ndevice that accepts any multichannel PCM stream, encodes it to **AC3 (Dolby Digital)** in real\ntime, and streams it as an **IEC 61937 / S-PDIF** bitstream out a chosen **Toslink optical**\noutput to an AV receiver.\n\n\u003e **Also known as / what problem this solves:** a free, open-source software **Dolby Digital Live\n\u003e (DDL)** and **DTS Connect** alternative for Windows — for PCs whose sound card can't encode\n\u003e surround to optical, so you can get true **5.1 surround over a single Toslink / S-PDIF (optical)\n\u003e cable** to an AV receiver or soundbar. Essentially **SoundPusher for Windows**. Useful when\n\u003e \"Dolby Digital Live\" / \"DTS Interactive\" / \"DTS Connect\" isn't available on your motherboard or\n\u003e USB sound card (Realtek, ASUS Xonar, etc.).\n\u003e\n\u003e _Currently encodes **AC3 (Dolby Digital, 5.1, 640 kbps)**. DTS Connect-style **DTS** output is a\n\u003e feasible extension — FFmpeg ships a DTS encoder; see the design notes in `CLAUDE.md`._\n\n**Keywords:** Dolby Digital Live, DTS Connect, DTS Interactive, software AC3 encoder, real-time\nAC3/AC-3 encoder, 5.1 surround over optical/SPDIF/Toslink, IEC 61937 passthrough, WASAPI exclusive\npassthrough, virtual audio device/cable, FFmpeg AC3, SoundPusher for Windows, HTPC surround sound.\n\n## Download / install\n\nGet the latest **[Release](https://github.com/strepto42/virtual-ac3-encoder/releases/latest)**:\n- **`virtual-ac3-encoder-setup-x.y.z.exe`** — per-user installer (no admin); auto-starts hidden at\n  logon, with Start-Menu shortcuts for config / log / device list.\n- **`virtual-ac3-encoder-x.y.z-win64.zip`** — portable build; extract and run `engine.exe`\n  (see `QUICKSTART.txt`).\n\nYou also need a virtual audio cable to capture surround audio — install\n**[VB-CABLE](https://vb-audio.com/Cable/)** and set *CABLE Input* as your default 5.1 device — then\nconnect the optical output to your receiver. Prefer to build from source? See **Build** below.\n\nOptical (S-PDIF) can carry stereo PCM *or* a compressed 5.1 bitstream, never 5.1 PCM — so a\nsurround stream has to be encoded to AC3 on the PC before it leaves the optical port. Many\nonboard sound chips don't offer this; this project does it in software.\n\n## Architecture\n\nTwo components (the encoder is FFmpeg and **cannot** live in a kernel driver, so the work is\nsplit):\n\n1. **Kernel virtual audio driver** (`driver/`) — a PortCls/WaveRT virtual cable (SYSVAD-derived)\n   that publishes a 5.1 render endpoint plus a paired loopback-capture endpoint. *Phase 3.*\n2. **User-mode engine** (`engine/`) — captures the 5.1 PCM, encodes AC3, wraps it as IEC 61937,\n   and renders it to the optical endpoint via WASAPI exclusive passthrough.\n\nThe engine's real-time design (output clock = master, lock-free ring buffer between capture and\noutput, drift correction by periodic latency-trim) is modeled on\n[SoundPusher](https://codeberg.org/q-p/SoundPusher) (MIT), the equivalent macOS tool. The AC3\nencode + S-PDIF mux uses **FFmpeg** (`libavcodec` AC3 encoder + `spdif` muxer + `libswresample`),\nthe same engine Kodi uses internally. See `third_party/reference/` for the cloned references.\n\n## Status\n\n- [x] **Phase 1 — offline encoder core.** `SpdifEncoder` (PCM → AC3 640 kbps 5.1 → IEC 61937)\n      + lock-free `RingBuffer` + WAV test harness. Verified: output decodes as\n      `ac3, 48000 Hz, 5.1, 640 kb/s`.\n- [x] **Phase 2 — live WASAPI engine.** Shared capture/loopback → ring buffer → exclusive\n      IEC 61937 passthrough (output = master clock; SoundPusher-style 64-cycle drift-trim).\n- [x] **TDD harness.** doctest `unit_tests` (RingBuffer incl. SPSC stress + encoder contract).\n- [x] **Phase 3 — kernel virtual audio driver, built \u0026 test-signed.** 5.1 render-only virtual\n      endpoint (\"Virtual AC3 Encoder (5.1)\"). Loads only with Secure Boot OFF (see Install).\n- [x] **Working end-to-end (confirmed).** Because Secure Boot is ON here, the live system uses\n      **VB-CABLE** as the 5.1 source: `engine --in \"CABLE Output\" --out \"Realtek Digital Output\"`\n      → receiver decodes **Dolby Digital**. (Our own driver is ready for when Secure Boot is off.)\n- [ ] **Phase 4 — packaging** (config file + auto-start at logon; optional tray UI).\n\n## Components / engine flags\n\n`engine.exe`:\n- `--list` — list render + capture endpoints.\n- `--probe` — which outputs accept AC3 passthrough (IsFormatSupported, non-intrusive).\n- `--mon` — capture-only throughput diagnostic (non-intrusive).\n- `--loopback` — treat `--in` as a *render* endpoint and capture it via WASAPI loopback\n  (used with the virtual driver).\n- `--in \u003cname\u003e` / `--in-id \u003cid\u003e` / `--out \u003cname\u003e` / `--out-id \u003cid\u003e` / `--out-spdif`\n- `--bitrate \u003cbps\u003e` (default 640000) / `--safe \u003cframes\u003e` (drift target, default 1536)\n- `--config \u003cpath\u003e` (defaults to `virtual-ac3-encoder.conf` next to the exe) ·\n  `--hidden` (hide console) · `--log \u003cpath\u003e` (log to file) · `--duration \u003cs\u003e` (auto-stop)\n- `--upmix surround|off` — for stereo input, upmix to 5.1 via FFmpeg's `surround` filter\n  (a free DTS Neo:PC / Pro Logic II-style matrix upmix). **Default `surround`**; use `off` for\n  untouched stereo→front. Multichannel input is downmixed regardless.\n\nConfig precedence: built-in defaults \u003c config file (`key=value`: `in`, `out`, `in_id`, `out_id`,\n`bitrate`, `safe`, `loopback`, `out_spdif`, `upmix`) \u003c command-line flags.\n\n## Driver (Phase 3)\n\nDerived from Microsoft's SimpleAudioSample (`third_party/reference/wds`), trimmed to a single\n5.1 render endpoint and rebranded. Build (WDK 10.0.26100 + VS2022):\n\n```powershell\n\u0026 \"C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\MSBuild\\Current\\Bin\\amd64\\MSBuild.exe\" `\n  driver\\SimpleAudioSample.sln /p:Configuration=Release /p:Platform=x64 /p:SpectreMitigation=false\n# output: driver\\x64\\Release\\package\\  (SimpleAudioSample.sys / .inf / .cat)\n```\n\n### Install (requires Secure Boot OFF for a test-signed driver)\n\n```powershell\n# 1. Disable Secure Boot in your UEFI/BIOS (manual).\n# 2. Elevated PowerShell:\nscripts\\install-driver.ps1 -EnableTestSigning   # enables test signing + trusts the test cert\n# 3. Reboot.\nscripts\\install-driver.ps1                        # creates the ROOT\\SimpleAudioSample device\n# Uninstall: scripts\\uninstall-driver.ps1 [-DisableTestSigning]\n```\n\n## Running it\n\n```powershell\n# With the virtual driver installed (render-only + loopback):\nengine\\build\\Release\\engine.exe --loopback --in \"Virtual AC3 Encoder\" --out \"Realtek Digital Output\"\n\n# Or, without the driver, using an existing virtual cable (works with Secure Boot ON):\nengine\\build\\Release\\engine.exe --in \"CABLE Output\" --out \"Realtek Digital Output\"\n```\n\nSet the virtual device as the Windows default 5.1 output, play surround content, and switch the\nreceiver to the matching optical input — it should report Dolby Digital.\n\n## Set and forget (autostart)\n\nInstall the engine to a stable per-user location and have it start hidden at every logon, with\nrestart-on-failure (no elevation, no Task Scheduler — a Startup-folder supervisor that runs in the\nreal interactive session):\n\n```powershell\nscripts\\setup-autostart.ps1                                   # VB-CABLE -\u003e Realtek (defaults)\nscripts\\setup-autostart.ps1 -In \"CABLE Output\" -Out \"Realtek Digital Output\" -Bitrate 640000\nscripts\\setup-autostart.ps1 -In \"Virtual AC3 Encoder\" -Loopback   # when using our own driver\nscripts\\remove-autostart.ps1 [-DeleteInstall]                 # undo\n```\n\nThis stages `engine.exe` + DLLs to `%LOCALAPPDATA%\\virtual-ac3-encoder`, writes\n`virtual-ac3-encoder.conf` there (edit it to change devices/bitrate), and drops a supervisor in the\nStartup folder that runs `engine --hidden --log` and relaunches it if it exits.\n\n## Build (engine)\n\nRequires Visual Studio 2022 (or Build Tools) and CMake. FFmpeg shared dev libs are fetched\ninto `third_party/ffmpeg/`.\n\n```powershell\n# 1. Fetch FFmpeg dev libraries (DLLs + import libs + headers)\nscripts\\fetch-ffmpeg.ps1\n\n# 2. Configure + build\ncmake -S engine -B engine\\build -G \"Visual Studio 17 2022\" -A x64\ncmake --build engine\\build --config Release\n```\n\n## Phase 1 test\n\n```powershell\nscripts\\make-test-wav.ps1                       # generates engine\\test\\test_5p1.wav (5.1 tones)\nengine\\build\\Release\\encode_wav.exe engine\\test\\test_5p1.wav engine\\test\\out.spdif\n\n# Verify the result is real AC3 inside IEC 61937:\nffmpeg -f spdif -i engine\\test\\out.spdif -f null -\n```\n\n## License\n\n**MIT** — see [`LICENSE`](LICENSE). The kernel driver is derived from Microsoft's MIT-licensed\nSimpleAudioSample, and the engine design is modeled on SoundPusher (MIT); the engine dynamically\nlinks FFmpeg (LGPL). Full attributions are in [`NOTICE.md`](NOTICE.md). No third-party binaries\n(FFmpeg, VB-CABLE) are committed — they're fetched/installed separately.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstrepto42%2Fvirtual-ac3-encoder","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fstrepto42%2Fvirtual-ac3-encoder","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstrepto42%2Fvirtual-ac3-encoder/lists"}