Skip to content

Experiment: Option to transcode surround sound audio to AC3#947

Draft
damontecres wants to merge 4 commits intomainfrom
develop/ac3-test
Draft

Experiment: Option to transcode surround sound audio to AC3#947
damontecres wants to merge 4 commits intomainfrom
develop/ac3-test

Conversation

@damontecres
Copy link
Copy Markdown
Owner

@damontecres damontecres commented Feb 21, 2026

This is an experiment and may not be merged!

Description

Adds a toggle (ugh) to prefer transcoding AAC/OPUS audio with more than 2 channels to AC3. Stereo AAC does not transcode.

This is basically a workaround for HDMI ARC (not eARC) or optical audio devices because instead of 2 uncompressed PCM channels, 6 AC3 channels (ie 5.1) is possible.

An downside of enabling this is that embedded subtitles be burned in causing a video transcode as well.

Related issues

Fixes #255

Testing

Just on the emulator so far to observe if the settings trigger the transcode or not

Screenshots

N/A

AI or LLM usage

None

@damontecres damontecres added enhancement New feature or request playback Related to media playback labels Feb 21, 2026
@n8llcaster
Copy link
Copy Markdown

n8llcaster commented Feb 25, 2026

Merged this to 0.5.1 release and tested on Yamaha ARC receiver + Sony Android TV.

When playing AAC 5.1 it will convert it to AC3 5.1 and play beautifully on receiver as it should, but there are downsides as you mentioned.

When this conversion occurs it indeed does seems to do something with video somewhere - i don't have explanation for this except black magic. From what I can see in Jellyfin server logs it just direct stream (copy) video , transcode audio to ac3 (-codec:a:0 ac -ac 6 -ab 640000) a send it. This is especially jarring when using/changing subtitles. Maybe problem on Wholphin side?

Also I managed to break this fix entirely when transcoded video started playing, i changed audio to basic AC3 track in another language and activated subtitles there - then returned audio to original AAC track and activated subtitles ... AAC collapsed to PCM 2.0 and video no longer transcoded :D

Kinda wondering if the changes in DeviceProfileUtils.kt would not be the culprit.

@damontecres
Copy link
Copy Markdown
Owner Author

do something with video somewhere [..] jarring when using/changing subtitles

What do you mean? Like the video is glitching?

then returned audio to original AAC track and activated subtitles ... AAC collapsed to PCM 2.0 and video no longer transcoded

Oh yeah. There's some special logic when switching tracks if direct play is occurring. It will bypass using the device profile to check with the server if the newly selected tracks are direct playable from ExoPlayer's perspective. Not sure if I explained that well enough, but I know where to fix this in the code.

@nitram3
Copy link
Copy Markdown

nitram3 commented Mar 2, 2026

I'm very interested in this PR, since I have a S/PDIF connection with my receiver. And I currently can't use Wholphin because of this.
But am I understanding this right?

An downside of enabling this is that embedded subtitles be burned in causing a video transcode as well.

I either won't be able to use subtitles or videos will always be transcoded together with audio?

@damontecres
Copy link
Copy Markdown
Owner Author

I either won't be able to use subtitles or videos will always be transcoded together with audio?

If the audio is being transcoded, then if you enable an embedded subtitle track, it will switch the video to transcode as well in order to burn-in the subtitles.

But, I still need to investigate a bit more because I believe this situation happens because the transcoded stream is .ts container which has more limited subtitle options. Potentially using fmp4 (see #686) might not require burning in the subtitles.

@nitram3
Copy link
Copy Markdown

nitram3 commented Mar 4, 2026

I see. Thanks for explaining!

@n8llcaster
Copy link
Copy Markdown

What do you mean? Like the video is glitching?

Just annoying waiting time every time you change something because of the transcode issue. Sorry for confusion :)

@damontecres
Copy link
Copy Markdown
Owner Author

then returned audio to original AAC track and activated subtitles ... AAC collapsed to PCM 2.0 and video no longer transcoded

@n8llcaster The latest commit, 5d6b8ff, should fix this now.

I'll eventually need to figure out a better, more generalized way to handle this type of "unsupported" track, but for now, this should work.

@hdanielhfv
Copy link
Copy Markdown

First of all, thanks to the creators of WHOLPHIN for the best app I've tried for Jellyfin 👍

​I tried everything to transcode OPUS 5.1 and AAC 5.1 on Smart TVs (Android TV, LG webOS, and Samsung Tizen) to use the SPDIF and HDMI ARC outputs. On Android, the only external players that worked were Kodi and Vimu Media Player.
​However, I don’t like using external players, and this solution obviously excludes Samsung and LG.
​The best solution I found to save space—especially when you have thousands of videos and want to avoid bloating your storage—was to use official E-AC3 (not ffmpeg). It is the only format that is backwards compatible with older receivers and soundbars that only support AC3.
​Samsung, LG, and Google TV take the DD+ (E-AC3) signal and transcode it on the fly to DD (AC3).

​I installed the experimental WHOLPHIN version and enabled AC3 transcoding, but it didn't work on my Smart TV running Google TV 12.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request playback Related to media playback

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] - AAC 6/8-channel audio only outputs as Stereo PCM

4 participants