Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ARC audio output mode with updated codec profiles and transcoding #3936

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

MichaelRUSF
Copy link
Contributor

@MichaelRUSF MichaelRUSF commented Aug 26, 2024

This PR adds an HDMI ARC audio output mode to address playback issues with high-resolution and uncompressed audio formats over an ARC connection in Jellyfin. Updates to the ExoPlayerProfile class and incorporates a new audio output preference. The PR ensures compatibility with PCM and TrueHD formats by transcoding unsupported surround sound formats to AC3, maintaining surround sound capabilities.

Changes

  1. Preference Option:

    • Added HDMI_ARC_OUTPUT option in AudioBehavior to allow users to enable HDMI ARC audio output.
  2. New Parameter:

    • Added enableARCAudio parameter to ExoPlayerProfile.
    • Added AudioBehavior.HDMI_ARC_OUTPUT condition to PlaybackController.
  3. Updated Audio Codecs:

    • Added downmixARCSupportedAudioCodecs for ARC audio.
    • Adjusted allSupportedAudioCodecs to include/exclude codecs based on enableARCAudio.
    • Updated audio codec selection for transcoding and direct play profiles based on new settings.
    • Added maximum audio channel profiles specifically for ARC audio.

Issues

Fixes: #3900 #3903 #2991

@svemonix
Copy link

svemonix commented Sep 5, 2024

Thanks for the contribution and this is a very good step in the right direction. However I believe the multichannel audio issue will only be partially fixed just like on the Plex client.

Basically the use case not covered is the following. Many Android TV devices can't output multichannel PCM which means that multichannel AAC will be output as 2.0 PCM on a receiver plugged in via ARC. Now, you could activate the S/PDIF mode which would solve the multichannel AAC playback by transcoding to AC3.
The issue here is that it won't allow DD+ playback including DD+ Atmos even though the device and receiver supports it via ARC. It would also limit to 5.1.

So far the only client that can handle this properly is Kodi since it has more advanced settings. Maybe there should be a DD+ toggle together with the S/PDIF & ARC one.

@MichaelRUSF
Copy link
Contributor Author

The issue here is that it won't allow DD+ playback including DD+ Atmos even though the device and receiver supports it via ARC. It would also limit to 5.1.

That statement is incorrect. Did you test a debug build, or are you making assumptions based on what you believe? AC3 (Dolby Digital) and EAC3 (Dolby Digital Plus) audio are not limited and behave the same as they would in direct play.

@svemonix
Copy link

svemonix commented Sep 5, 2024

The issue here is that it won't allow DD+ playback including DD+ Atmos even though the device and receiver supports it via ARC. It would also limit to 5.1.

That statement is incorrect. Did you test a debug build, or are you making assumptions based on what you believe? AC3 (Dolby Digital) and EAC3 (Dolby Digital Plus) audio are not limited and behave the same as they would in direct play.

As stated it was an assumption but looking at the details maybe there is an issue the other way around.

if ((isAC3Enabled) || (enableSPDIF)) { add(Codec.Audio.AC3) add(Codec.Audio.EAC3)

Isn't it gonna try to direct play and passthrough EAC3 even if using SPDIF (e.g. optical)? SPDIF doesn't support EAC3 only ARC.

@salty-sweet
Copy link

salty-sweet commented Sep 5, 2024

SPDIF doesn't support EAC3 only ARC.

I'd like to say that EAC3 can run through SPDIF up to 5.1 channels only. To temporarily work around the inconvenience caused by #3900, I am currently using a SPDIF connection for audio. Dolby Digital Plus 5.1 channel (and also limited to 1024kbps because more than that specific bitrate, FFMPEG-transcoded DDP/EAC3 audio doesn't work on my AVR) does work.

There could be some channel check in there as well to allow 5.1 EAC3, and filter out 7.1 over SPDIF.

@MichaelRUSF
Copy link
Contributor Author

This PR is aimed at ARC rather than Optical audio, despite the name of the option. The name "SPDIF" was chosen because it is more commonly used across other platforms compared to eARC vs. ARC. However, if this naming is causing confusion, it can be changed.

Targeting Optical audio would result in the loss of EAC3/JOC (DD+ with Dolby Atmos) and limit DD to 5.1, which is not the goal of this PR. If issues arise for optical users after merging this PR, they can be addressed. My objective is to keep this process straightforward and get the PR merged.

@@ -516,6 +516,7 @@
<string name="past_24_hours">Past 24 hours</string>
<string name="prefer_exoplayer_ffmpeg">Prefer FFmpeg for audio playback</string>
<string name="prefer_exoplayer_ffmpeg_content">Use FFmpeg to decode audio, even if platform codecs are available.</string>
<string name="audio_spdif">SPDIF</string>
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Other name options to better describe this output mode:
ARC
ARC Audio
HDMI Audio

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for clarifying the intent of the PR.

To avoid confusion, I'd suggest ARC or maybe even better HDMI ARC.

HDMI Audio is probably too vague as it doesn't differentiate ARC and eARC and would just sound like it means HDMI audio passthrough.

ARC Audio seems a bit redundant as ARC already contains Audio.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

HDMI ARC seems like the better option, will update to reflect this.

@MichaelRUSF MichaelRUSF changed the title Add a S/PDIF audio output mode Add ARC audio output mode with updated codec profiles and transcoding Sep 5, 2024
@jellyfin-bot jellyfin-bot added the merge conflict Conflicts prevent merging label Sep 8, 2024
@jellyfin-bot jellyfin-bot removed the merge conflict Conflicts prevent merging label Sep 8, 2024
@jellyfin-bot jellyfin-bot added the merge conflict Conflicts prevent merging label Oct 4, 2024
@WortelSoep

This comment was marked as off-topic.

@nextlooper42

This comment was marked as off-topic.

@jellyfin-bot jellyfin-bot removed the merge conflict Conflicts prevent merging label Nov 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

AAC 6/8-channel audio only outputs as Stereo PCM
7 participants