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

Audio Transcode Issues #513

Closed
Aragorn84 opened this issue Dec 31, 2021 · 18 comments · Fixed by #543
Closed

Audio Transcode Issues #513

Aragorn84 opened this issue Dec 31, 2021 · 18 comments · Fixed by #543

Comments

@Aragorn84
Copy link

This might be multiple issues, or it may all be linked together, but i'll create one bug to start with.

When trying to play videos with "unsupported audio" and HEVC HDR video, this results in the system going into full Transcode mode.

As a result, the HDR video is lost (its transcoded to tone-mapped SDR)

Expected behaviour would be to operate in "Direct Stream" mode and only transcode the audio. If you force-disable video transcoding for the user, the system DOES then operate in direct stream mode.

Additionally, the audio transcode itself is acting in an odd way, i've tried a few videos, one with Opus 7.1, one with DTS-MA 7.1 and one with TrueHD (Atmos). In all cases the audio is transcoded to 2 channel stereo AAC.

DTS-MA 5.1 seems to work correctly (DTS Core 5.1 is sent, as the Roku doesnt support DTS-MA)

Expected behaviour: DTS-MA 7.1 should also send DTS Core, for the others, the device profile knows AC3 is available, so why are we not transcoding to AC3 instead to maintain the 5.1 surround channels? I dont think the Roku even supports multi-channel AAC?

@Aragorn84
Copy link
Author

Log-Opus7.1-DirectStream(video transcode force disabled).txt
Log-Opus7.1-Transcode.txt

Attaching logs of the Opus7.1 file. I can attach more if needed.

Worth noting the AAC being produced is actually 5.1, however the output to the Amp is 2.0. Looking at Roku's technical details, they dont seem to support AAC 5.1 passthru, and thus they convert the AAC 5.1 signal to 2.0 PCM.

https://support.roku.com/article/208754908

We should never be sending 5.1 AAC to a Roku.

@dblitt
Copy link

dblitt commented Jan 6, 2022

I think I am having a similar issue. I have some content with 5.1/7.1 AAC and I want to play it back on my 5.1 surround system. However, the content is always downmixed to a stereo 2.0 stream and my surround sound system reports only receiving a 2.0 signal over HDMI. When I pre-transcode the audio to a E-AC3 5.1 mix, everything works fine as it is the supported 5.1 codec of my roku:

https://developer.roku.com/docs/specs/media/streaming-specifications.md#supported-audio-codecs

As Aragorn84 said, we should never be sending 5.1 AAC to a roku, but when E-AC3 (DD+) is sent everything works fine. Obviously I haven't fully investigated the issue but I think this would be solved by requesting Jellyfin transcode the audio to E-AC3 on the fly.

As an aside, I also had issues with DTS 5.1 being downmixed to stereo, but I haven't fully investigated that either.

@neilsb
Copy link
Member

neilsb commented Jan 8, 2022

When trying to play videos with "unsupported audio" and HEVC HDR video, this results in the system going into full Transcode mode.

So this is an issue with the server. There's is an open PR to resolve it that will hopefully be in the 10.8 release (jellyfin/jellyfin#6454)

We should never be sending 5.1 AAC to a Roku.

I can see your point about 5.1 AAC Passthrough, but I'm not sure that we should "never be sending" it to the Roku. If a user does not have an external decoder, but the Roku can downmix - that should be a valid reason to send the 5.1 stream. The alternative would be to force the server to transcode to 2 channels (which right now will trigger the full transcode issue) which is just putting unnecessary load on the server.

Perhaps checking if Passthrough is enabled and if so, transcode 5.1 AAC to E-AC3.

@Aragorn84
Copy link
Author

Surely we are already checking if passthru is enabled? Roku supports only Stereo if there is no passthru. So in that case, the Roku would tell the server it can only do 2.0 and the server would transcode to 2.0 anyway right? I need to try this out to confirm, but thats what i would expect to happen?

@Aragorn84
Copy link
Author

So this is an issue with the server. There's is an open PR to resolve it that will hopefully be in the 10.8 release (jellyfin/jellyfin#6454)

This sounds hopeful to fix that portion of the problem! Certainly seems odd to me that it all works fine if you force-disable video transcoding for the user, and i guess it makes sense that its a server issue. I'll report back on this aspect once 10.8 releases.
For my home use, i can live with having the transcoding disabled for the Roku user, and remote users are always transcoding anyway for bitrate reasons, so that part is work-aroundable.

@neilsb
Copy link
Member

neilsb commented Jan 8, 2022

Currently, we are not. We are just asking the Roku what it supports, and only transcoding if the requested audio stream is not supported. My device (Streaming Stick+) reports that the following are supported with no passthrough enabled:

aac:  1  2  3  4  5  6 
ac3: 
eac3: 
alac:  1  2  3  4  5  6 
flac:  1  2  3  4  5  6 
mp2:  1  2 
mp3:  1  2 
vorbis:  1  2  3  4  5  6 
wma:  1  2  3  4  5  6 
wma pro: 
dts: 
ac4: 

As a result, I suspect Roku us downmixing all of that to 2 channel.

Edit: Fixed formatting to show aac

@Aragorn84
Copy link
Author

fair enough.

Is there a reason AAC is not in that list?

I guess theres a conflict.

Personally, i would prefer the Roku simply never advertises that AAC 5.1 is available, and let the server do the work if required. In my cases, the server is having to transcode anyway, because the audio formats are already unsupported by the roku (7.1/TrueHD/Opus etc).

Furthermore, it ensures quality is never lost unneccesarily. If the server has to transcode 5.1 AAC to 2.0 because the Roku is in Stereo mode, nothing is lost. However if the server does what its doing currently we are losing the whole surround track.

Part of the issue is that when BOTH AC3 and AAC are offered, and the server needs to transcode, it chooses to use AAC instead of AC3. Can we simply prioritise AC3/EAC3 over AAC when transcode is needed?

@neilsb
Copy link
Member

neilsb commented Jan 8, 2022

Is there a reason AAC is not in that list?

My bad GitHub formatting. That's it showing now.

However if the server does what its doing currently we are losing the whole surround track.

I'm not sure that the tracks are just lost. Roku does specify "Downmixing" so I suspect there is some work done to mix them into the stereo output rather than just dropping the extra channels.

Personally, i would prefer the Roku simply never advertises that AAC 5.1 is available

I'm trying to find a solution that would be the best for the majority of users. We have a lot of users that run off very low power hardware and never want to transcode. When we get client side options in place we can make it more configurable for users who want to fiddle with that.

However, as a starting point - how does this sound?

IF External Decoder Present & supports > 2 channel THEN
    Advertise externally supported codecs with appropriate channels
    Advertise Roku supported codecs with a max of 2 channels
ELSE
   Advertise external & roku supported codecs with the max channels reported

This would mean that if someone had a 2.0 decoder connected, and it media was 5.1 AAC, then it would direct stream and let the Roku handle the downmixing. But if they had a 2.1 decoder connected, it should transcode to AC3/EAC3 2.1 so that the third channel could be used?

@Aragorn84
Copy link
Author

Sounds good if that is possible!

Can i help by providing any details from my unit with the amp connected?

@21teddy
Copy link

21teddy commented Mar 3, 2022

What really needs to happen is to add a list for advanced users so they can select which audio to pass through.

Since receivers/decoders vary in capability and Roku will pass through audio it can't decode, the advanced user can select what works with pass through to their receiver/decoder and what doesn't.

To avoid thousands of "no audio" complaints just put in a "Fix Audio" button that switches Jellyfin back to the standard profile for the device for the luddite users.

In my case, pass through for DTS-MA works with one media server but not Jellyfin. It plays audio in both but Jellyfin wants to transcode it, and it doesn't need to, for me.

@whiteowl3
Copy link
Contributor

whiteowl3 commented Mar 28, 2022

has anybody tested this since jellyfin/jellyfin#7325 landed?
edit:
oh lol u prolly need this one too: jellyfin/jellyfin#7496

@whiteowl3
Copy link
Contributor

It still does it on the beta. using a 1080p HEVC HDR video with DD+ 5.1, full transcoding of all streams occurs with the stated reason "Audio codec not supported"
@neilsb , if you would please convey your latest understanding of the issue at your convenience, I would very much appreciate it. I intend to dig into this with my next available hours and don't want to duplicate work (since i will definitely be the less qualified duplicate lol). is this still a server issue, even after 7325/7496? What is your understanding of the next necessary steps? If I don't hear I will just assume you do not approve of me tagging you in. Thanks either way.

@21teddy
Copy link

21teddy commented Mar 28, 2022 via email

@neilsb
Copy link
Member

neilsb commented Mar 28, 2022

@whiteowl3 My understanding is that if audio stream requires transcoding, then the video is transcoded to the preferred format at the same time (assuming it's not already in that format)

I think that the server changes will go a long way to sorting this, and the limited testing of it I did against the PR seemed to indicate that if the video was in a compatible format (even if not preferred) then it wouldn't transcode it.

I suspect there may be additional changes that could be made to the Roku device profile, that may help without the server changes (for older servers), but I'm not 100% sure.

@dathbe
Copy link

dathbe commented May 16, 2023

@neilsb , I see that the HEVC issue is fixed, but did that also fix your audio downmixing issue? I'm getting a similar problem where the Jellyfin app will not stream DTS audio to my Roku tv, and instead transcodes to AAC 2.0. Where did you look to create your table above where you looked up which audio formats "are supported with no passthrough enabled" on your device? My tv claims to be DTS capable.

@21teddy
Copy link

21teddy commented May 17, 2023 via email

@21teddy
Copy link

21teddy commented May 17, 2023 via email

@dathbe
Copy link

dathbe commented May 17, 2023

Not particularly helpful. When someone points out there’s a compatibility bug, saying “get new stuff” is generally not answer. It’s not surprising some setups work. I have one that works. This one doesn’t. There’s an issue where Jellyfin and/or the Jellyfin Roku app thinks that my tv is not capable of dts when it is. Help in troubleshooting that would be appreciated.

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 a pull request may close this issue.

6 participants