[PR #5115] [MERGED] Force AAC transcode when streaming mka+opus to desktop client #4432

Closed
opened 2026-04-25 00:19:43 +02:00 by adam · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/advplyr/audiobookshelf/pull/5115
Author: @rktjmp
Created: 3/10/2026
Status: Merged
Merged: 4/10/2026
Merged by: @advplyr

Base: masterHead: fix-mka-opus-desktop-streaming


📝 Commits (3)

  • d9355ac Force AAC transcode when streaming mka+opus to desktop client
  • 522b973 Add audio/(x-)matroska to client player MIME types to avoid transcode
  • 94c426b Update comments on matroska

📊 Changes

3 files changed (+17 additions, -2 deletions)

View changed files

📝 client/players/LocalAudioPlayer.js (+14 -1)
📝 server/objects/Stream.js (+1 -1)
📝 server/utils/constants.js (+2 -0)

📄 Description

Brief summary

Support streaming Matroska audio containers with Opus streams inside them to the desktop client.

Which issue is fixed?

https://github.com/advplyr/audiobookshelf/issues/5114

In-depth Description

Matroska audio containers (aka mka files) with Opus codec streams inside were unplayable on the desktop client because hls.js was unable to decode the stream, resulting in an infinitely "spinning" play button.

When configuring a stream, we now check for the opus codec and force AAC transcoding.

Matroska containers support other codecs besides Opus, eg: mp3, which do not require transcoding and work fine before this patch, which is why we check for opus in codecsToForceAAC instead of AudioMimeType.MKA in mimeTypesToForceAAC.

The AudioMimeType.OPUS mimetype is already marked as requiring transcoding but since its inside a container this check does not evaluate to true, we must check the codec explicitly.

How have you tested this?

By using these sample files created from a public domain recording:


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/advplyr/audiobookshelf/pull/5115 **Author:** [@rktjmp](https://github.com/rktjmp) **Created:** 3/10/2026 **Status:** ✅ Merged **Merged:** 4/10/2026 **Merged by:** [@advplyr](https://github.com/advplyr) **Base:** `master` ← **Head:** `fix-mka-opus-desktop-streaming` --- ### 📝 Commits (3) - [`d9355ac`](https://github.com/advplyr/audiobookshelf/commit/d9355ac3aa175e9184db64e42c62a934aab933a0) Force AAC transcode when streaming mka+opus to desktop client - [`522b973`](https://github.com/advplyr/audiobookshelf/commit/522b9735e22dabc111eb47cb5d5e814bc1c1c351) Add `audio/(x-)matroska` to client player MIME types to avoid transcode - [`94c426b`](https://github.com/advplyr/audiobookshelf/commit/94c426bd971a40771e8a3503af3eafd01cc89c73) Update comments on matroska ### 📊 Changes **3 files changed** (+17 additions, -2 deletions) <details> <summary>View changed files</summary> 📝 `client/players/LocalAudioPlayer.js` (+14 -1) 📝 `server/objects/Stream.js` (+1 -1) 📝 `server/utils/constants.js` (+2 -0) </details> ### 📄 Description ## Brief summary Support streaming Matroska audio containers with Opus streams inside them to the desktop client. ## Which issue is fixed? https://github.com/advplyr/audiobookshelf/issues/5114 ## In-depth Description Matroska audio containers (aka `mka` files) with Opus codec streams inside were unplayable on the desktop client because hls.js was unable to decode the stream, resulting in an infinitely "spinning" play button. When configuring a stream, we now check for the `opus` codec and force AAC transcoding. Matroska containers support other codecs besides Opus, eg: mp3, which do not require transcoding and work fine before this patch, which is why we check for `opus` in `codecsToForceAAC` instead of `AudioMimeType.MKA` in `mimeTypesToForceAAC`. The `AudioMimeType.OPUS` mimetype is already marked as requiring transcoding but since its inside a container this check does not evaluate to true, we must check the codec explicitly. ## How have you tested this? By using these sample files created from a public domain recording: - [mka+opus, 9mb](https://files.catbox.moe/71hpeh.mka) - [mka+mp3, 35mb](https://files.catbox.moe/poa4ag.mka) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
adam added the pull-request label 2026-04-25 00:19:43 +02:00
adam closed this issue 2026-04-25 00:19:43 +02:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/audiobookshelf#4432