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

Fix webOS DTS audio support #2971

Merged
merged 5 commits into from
Oct 27, 2021
Merged

Fix webOS DTS audio support #2971

merged 5 commits into from
Oct 27, 2021

Conversation

dmitrylyzo
Copy link
Contributor

@dmitrylyzo dmitrylyzo commented Sep 14, 2021

previously: #2942

After discussion on Matrix, we decided to make a new PR.

As far as I understand, LG has discontinued supporting DTS on 2020 TV models.
I can't find an official statement, and the documentation is inconsistent (DTS is in mkv, but at least it's not in avi).

Changes

  • Add webOS version detection
  • Disable DTS on webOS 5+

Issues
jellyfin/jellyfin-webos#56

To support this in webOS browser, we need to detect NetCast as webOS (#2781).

References
[Web Engines] https://webostv.developer.lge.com/discover/specifications/web-engine/

@dmitrylyzo dmitrylyzo added the p: webos This PR or issue mainly concerns WebOS clients label Sep 14, 2021
Copy link
Member

@EraYaN EraYaN left a comment

Choose a reason for hiding this comment

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

LGTM, seems like they stopped paying for the license.

@EraYaN
Copy link
Member

EraYaN commented Sep 17, 2021

So it seems those versions don't seem to hold up in the webOS browser, since at least on my Chromium 53 equipped WebApp Engine based TV the browser is actually Chromium 79. And it's a 2018 WebOS v4 TV.

@dmitrylyzo
Copy link
Contributor Author

tbh, NetCast version detection looks unreliable.
We need a user agent string for webOS 5 (6 optional).

@whiteworthy
Copy link

Can confirm detection doesn't work on the browser on webOS 5, although it does work on the webOS app, playback appears to completely break after 1 to 3 minutes (on the same exact timestamp every time I test it, so it isn't random), which is weird since it doesn't happen with other transcoded codecs like TrueHD. Can't see anything special on logs or ffmpeg logs so if anyone has tested this yet please let me know if you encounter a similar issue. I found a workaround that requires you to select a direct play audio track such as an AC3 commentary and start playback with it, then switching back to the main DTS track and it won't freeze, however, it is unreliable since not every movie has a commentary track on it... I have no idea what's going on.

@dmitrylyzo
Copy link
Contributor Author

@whiteworthy
After you switch back to DTS, the video plays as Direct stream, transcoding the audio, right?
Could you post mediainfo of that broken playback?

Also, could you open https://shaka-player-demo.appspot.com/support.html in the webOS browser and post version of Chrome and SmartTV from the user agent string at the top?

@Mchar7
Copy link

Mchar7 commented Sep 22, 2021

previously: #2942

I can't find an official statement, and the documentation is inconsistent (DTS is in mkv, but at least it's not in avi).

Pretty sure the DTS support in an MKV container on that chart is an error. I cannot get any DTS audio to play, including with MKVs. I'd assume there's no DTS across the board.

@whiteworthy
Copy link

Can confirm the above from Mchar7.

Yes it's playing as "Direct stream"

SmartTV is 10.0 and Chrome is 79.0.3945.79 (even though it's a 2020 model), I guess that confirms EraYaN suspicions that the LG documentation you linked is wrong.

I've been able to play some content without freezing, so I will post both mediainfo from content I've been able to play and content that freezes at a specific timestamp.

One that freezes at 1:14: https://gist.github.com/whiteworthy/8e349f2fd508312d408b41fbe3b4071e
One that doesn't freeze: https://gist.github.com/whiteworthy/e64a1c3ab61b4a25636b8571c8275e3a

@dmitrylyzo
Copy link
Contributor Author

dmitrylyzo commented Sep 24, 2021

So what do we have for the browser:
webOS 4: Chrome/79 SmartTV/10
webOS 5: Chrome/79 SmartTV/10
🤷‍♂️

We could try this (still not perfect because it can be false negative):

I hope we can forget about the browser when we release the app 😅

About video freezing.
I have no idea, except perhaps that selecting the DirectPlay combination somehow allows to bypass this block (looking at HEVC HDR).
@whiteworthy btw, for that freezing video, does it play as Transcoding (before it freezes) when you select DTS on the item detail page?

@whiteworthy
Copy link

If you mean stats for nerds it shows as Direct streaming "HEVC direct copy" and below it shows DTS to AAC, audio plays fine before the freeze, same info on jellyfin dashboard. Maybe it's a webOS app specific bug? I will test on the browser once you implement the fixes. I haven't found a 1080p video that freezes yet (I will test further soon), so it could be due to HDR, but it's confusing since I can play 4K HEVC HDR just fine on other movies. I will attach logs of when I try to play the freezing video, not sure if there's anything useful though.

Jellyfin (I stop playback right after video freezes): https://gist.github.com/whiteworthy/4bb3a0187861a36baa6c319051715b45
ffmpeg: https://gist.github.com/whiteworthy/b0479d253e79f554034728626353b024

I'm pretty sure it's due to a webOS update since I compiled a Default.cs transcoding profile that transcodes DTS and it worked just fine on the browser without freezing, and the fact my browser Chrome version was 68 before I updated further confirms it, couldn't find a changelog and there's no way to downgrade, unfortunately. I will make sure to never update webOS again.

@dmitrylyzo
Copy link
Contributor Author

I added what I said. The webOS browser should now transcode DTS if it isn't supported according to canPlayType.
I think that's all we can do. 😅

@dmitrylyzo dmitrylyzo marked this pull request as ready for review September 30, 2021 21:22
@sonarcloud
Copy link

sonarcloud bot commented Oct 15, 2021

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 2 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

Copy link
Member

@thornbill thornbill left a comment

Choose a reason for hiding this comment

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

Changes look fine, but I have no way of testing them currently.

@thornbill thornbill merged commit b6a13e4 into master Oct 27, 2021
@thornbill thornbill deleted the webos-dts-support branch October 27, 2021 04:41
@viennaa
Copy link

viennaa commented Dec 1, 2021

I could test it on a WebOS 5 LG TV. Is there a way to get the latest 10.8.0 release version into jellyfin-webos for deploying it on the TV?

@viennaa
Copy link

viennaa commented Dec 2, 2021

@dmitrylyzo @thornbill I've figured it out (podman build -t $USER/jellyfin . in the main repo) and have built a new image with latest master of jellyfin and jellyfin-web. The fix present works and finally there is sound for DTS files again, tested on a WebOS 5 LG CX tv.

log:

[18:04:27] [WRN] [10] Jellyfin.Server.Middleware.ResponseTimeMiddleware: Slow HTTP Response from http://10.0.0.1:8096/videos/***/hls1/main/58.ts?DeviceId=***&MediaSourceId=***&VideoCodec=h264,hevc&AudioCodec=aac,mp3,ac3,eac3&AudioStreamIndex=1&VideoBitrate=119616000&AudioBitrate=384000&PlaySessionId=***&api_key=***&TranscodingMaxAudioChannels=2&RequireAvc=false&Tag=***&SegmentContainer=ts&MinSegments=1&BreakOnNonKeyFrames=False&h264-profile=high,main,baseline,constrainedbaseline&h264-level=52&hevc-profile=main,main10&hevc-level=183&TranscodeReasons=AudioCodecNotSupported to 10.0.1.2 in 0:00:00.9310308 with Status Code 206

Really amazing work guys, thanks a lot for this fix.

This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
p: webos This PR or issue mainly concerns WebOS clients
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants