jellyfin / jellyfin-webos

WebOS Client for Jellyfin
https://jellyfin.org
Mozilla Public License 2.0
649 stars 68 forks source link

[bug] LG webos + Dolby Vision =⛔ movie stutters then hangs when resuming or skipping ahead #248

Open megosugit opened 1 month ago

megosugit commented 1 month ago

(bug is still present with 10.9.11)

Hello all,

this specific issue doesn't seem to be addressed in other topics, some are similar but not really, and most of them are more or less inactives. I have been hoping for a fix since I started with Jellyfin in march, but it hasn't come yet, so I'm trying my luck by opening this issue.

The issue: When I try to resume a Dolby Vision movie, or if I start over and then skip ahead (more than a few minutes), then the movie will start normally in direct play, but after 10 seconds (sometimes a bit more, I have managed to watch more than 10min once!), it starts to freeze for a few seconds, then can eventually continue for a few more seconds but will start to hang very quickly. If I don't touch anything for 1 or 2 minutes, I can see the movie "poster" flashing as if the movie stopped and started again, then it resumes the movie but this time it tries to transcode it, which gives bad colors and bad performance.

If I play the movie from the beginning, then it plays perfectly (in direct play). If I start from the beginning and skip ahead without exceeding ~3min each steps, I can eventually reach the part I need to, but it takes a long time to reach the correct position, and very often, the subtitles become out of sync. If I skip ahead more than ~3min in one go, then the "freezing/hanging/switching to transcoding" issue happens again when I stop skipping. After reading the forum, I have disabled the "prefer mp4" option without more success.

The TV (LG G3) is new and my Jellyfin installation too, so I can't tell when the issue started, but it has been doing it since I started to use Jellyfin in march.

Currently, I have given up with Dolby Vision movies, they are unwatchable, unless I know for sure I can watch it in one go without the need to stop and resume next time, which I can very seldom do :( I can't even disable Dolby Vision (on the TV or in Jellyfin) to avoid this issue and force HDR layer, so I'm pretty stuck whenever there is a DoVi movie.

Please find below a few examples of Video profiles that presents this issue (DV Profile 5 and 8.1 from what I can see):

Video Title: 4K HEVC HDR Codec: HEVC AVC: No Profile: Main 10 Level: 150 Resolution: 3840x1608 Aspect ratio: 2.40:1 Anamorphic: No Interlaced: No Framerate: 23.976025 Bitrate: 24443 kbps Bit depth: 10 bit Video range: HDR Video range type: DOVIWithHDR10 DV title: DV Profile 8.1 (HDR10) DV version major: 1 DV version minor: 0 DV profile: 8 DV level: 6 DV rpu preset flag: 1 DV el preset flag: 0 DV bl preset flag: 1 DV bl signal compatibility id: 1 Color space: bt2020nc Color transfer: smpte2084 Color primaries: bt2020 Pixel format: yuv420p10le Ref frames: 1

Video Title: 4K HEVC HDR Codec: HEVC AVC: No Profile: Main 10 Level: 150 Resolution: 3840x1606 Aspect ratio: 2.40:1 Anamorphic: No Interlaced: No Framerate: 24 Bitrate: 24795 kbps Bit depth: 10 bit Video range: HDR Video range type: DOVIWithHDR10 DV title: DV Profile 8.1 (HDR10) DV version major: 1 DV version minor: 0 DV profile: 8 DV level: 6 DV rpu preset flag: 1 DV el preset flag: 0 DV bl preset flag: 1 DV bl signal compatibility id: 1 Color space: bt2020nc Color transfer: smpte2084 Color primaries: bt2020 Pixel format: yuv420p10le Ref frames: 1

Video Title: 4K HEVC HDR Codec: HEVC AVC: No Profile: Main 10 Level: 150 Resolution: 3840x2160 Aspect ratio: 16:9 Anamorphic: No Interlaced: No Framerate: 24 Bitrate: 11494 kbps Bit depth: 10 bit Video range: HDR Video range type: DOVIWithHDR10 DV title: DV Profile 8.1 (HDR10) DV version major: 1 DV version minor: 0 DV profile: 8 DV level: 6 DV rpu preset flag: 1 DV el preset flag: 0 DV bl preset flag: 1 DV bl signal compatibility id: 1 Color space: bt2020nc Color transfer: smpte2084 Color primaries: bt2020 Pixel format: yuv420p10le Ref frames: 1

Video Title: 4K - HEVC - HDR Codec: HEVC AVC: No Profile: Main 10 Level: 150 Resolution: 3836x1600 Aspect ratio: 2.40:1 Anamorphic: No Interlaced: No Framerate: 23.976025 Bitrate: 16145 kbps Bit depth: 10 bit Video range: HDR Video range type: DOVI DV title: DV Profile 5 DV version major: 1 DV version minor: 0 DV profile: 5 DV level: 6 DV rpu preset flag: 1 DV el preset flag: 0 DV bl preset flag: 1 DV bl signal compatibility id: 0 Pixel format: yuv420p10le Ref frames: 1

I'm ready to help as much as I can, please let me know whatever you need and I'll try to get it asap :)

riberts commented 3 weeks ago

i just tried to play a movie and seem to have the same issue..

megosugit commented 3 weeks ago

i just tried to play a movie and seem to have the same issue..

what is you TV model ?

matteocnt92 commented 2 weeks ago

same issue on my LG C2

riberts commented 2 weeks ago

i just tried to play a movie and seem to have the same issue..

what is you TV model ?

LG G2

Acextreme1982 commented 2 weeks ago

Exactly the same issue I am facing now with my LG G3. At first, I thought it was the transcoding problem but on the server side, I can access all the temporary small parts of transcoded videos and I can play those on the server itself just fine using a normal media player, including the parts that hung on my LG G3. It's definitely something else that's the problem.

megosugit commented 2 weeks ago

I suspect every WebOS users have this issue with Dolby Vision content. This should get more attention, how can we get this thread more visibility ?

I wonder if it is posted in the right place ?

Acextreme1982 commented 2 weeks ago

Hmmm, well, let's do this: https://jellyfin.org/docs/general/contributing/issues

Under "Searching and Voting" section, it said the following:

If you do find an issue that matches, or closely matches, your issue, please make use of the 👍 reaction to confirm the issue also affects you or that you support the feature request. If you wish, add a comment as well describing your version of the issue or feature use case.

I just did that on your opening post. Everyone, please do that as well.

Acextreme1982 commented 2 weeks ago

I suspect every WebOS users have this issue with Dolby Vision content. This should get more attention, how can we get this thread more visibility ?

I wonder if it is posted in the right place ?

Hmmm, I think you need to do a couple more things. Like:

Bugs should be tagged with [bug] at the beginning of their title.

Check the above link and see what else you need to do right, otherwise it might affect their response.

megosugit commented 2 weeks ago

Hmmm, well, let's do this: https://jellyfin.org/docs/general/contributing/issues

Under "Searching and Voting" section, it said the following:

If you do find an issue that matches, or closely matches, your issue, please make use of the 👍 reaction to confirm the issue also affects you or that you support the feature request. If you wish, add a comment as well describing your version of the issue or feature use case.

I just did that on your opening post. Everyone, please do that as well.

I did too :p and I changed the title, thanks

megosugit commented 2 weeks ago

@gnattu or @GeorgeH005, is it something you would know about ?

stromrickard commented 2 weeks ago

I'm currently in the process of switching from Plex to Jellyfin and am reading up on any issues i might encounter and stumbled in here. I have 3 LG OLEDs, 77C1, 65C8 and a 48A1. I was however unable to replicate this on any of them. Resuming and skipping 20-30min causes no issues. Only point of this post is to indicate that the problem might be more elusive, only certain models, firmware versions, files etc. In case it matters, none of my TVs are on WiFi. Tested file: Titel4K HEVC HDR KodekHEVC AVCNo ProfilMain 10 Nivå150 Upplösning3840x1606 Bildförhållande2.40:1 AnamorfiskNo SammanflätadNo Bildfrekvens24 Bithastighet25313 kbps Bitdjup10 bit Video-omfångHDR VideointervallstypDOVIWithHDR10 DV titelDV Profile 8.1 (HDR10) DV huvudversion1 DV mindre version0 DV profil8 DV nivå6 Förinställd flagga för DV rpu1 Förinställd flagga för DV el0 Förinställd flagga för DV bl1 DV bl signalkompatibilitets-id1 Färgrymdbt2020nc Färgöverföringsmpte2084 Färgprimärerbt2020 Pixelformatyuv420p10le Referensbildrutor1

GeorgeH005 commented 2 weeks ago

@gnattu or @GeorgeH005, is it something you would know about ?

This was an issue that had come up during testing, but only when using the fmp4 container. When using ts, I wasn't able to replicate it. The only slightly enlightening error that had occurred was the app crashing (when using fmp4) reportedly due to running out of memory. Csn't tell you much more than that. Maybe the Jellyfin webUI (that this app is wrapping) is just too heavy? Haven't conducted any research so I can't answer that.

Edit: I am using a C3 and the tests were conducted on WebOS 23

Acextreme1982 commented 1 week ago

My files are in MKV container and as far as I know, all 3 files are using Profile 8.1 and all 3 had the same issue.

ppskj178 commented 6 days ago

I struggled with this for a while and eventually gave up.

Even videos by the same person have different symptoms.

Fortunately, recent videos seem to be less prone to the problem.

My guess is that the root of the problem lies with LG.

Dolby Vision only works with MP4 and the FLAC codec only supports audio, not video. TVs are meant for video only, and yet they have worse video compatibility than PCs and phones.

This is a serious problem.

megosugit commented 6 days ago

I struggled with this for a while and eventually gave up.

Even videos by the same person have different symptoms.

Fortunately, recent videos seem to be less prone to the problem.

My guess is that the root of the problem lies with LG.

Dolby Vision only works with MP4 and the FLAC codec only supports audio, not video. TVs are meant for video only, and yet they have worse video compatibility than PCs and phones.

This is a serious problem.

you can still put a thumb up on the first post, to gain more visibility, maybe it will be fixed eventually :)

ppskj178 commented 5 days ago

Have you tried to see if you can reproduce the same issue in other ways: plex, dlna, usb... If it's in mp4 format, I guess I can test it. Is this issue only happening with mkv?

GeorgeH005 commented 5 days ago

Have you tried to see if you can reproduce the same issue in other ways: plex, dlna, usb... If it's in mp4 format, I guess I can test it. Is this issue only happening with mkv?

USB is fine even with mp4 if I remember correctly, plex and dlna I haven't tested. I could test Plex, but I would have to reconvert a file to mp4.

klawson6 commented 5 days ago

Hi folks, I've narrowed my problem down to this issue as well.

LG OLED C2 (WebOS v8.3.0-29 (number1-nameri) Jellyfin v10.9.11

Playing .mkv files with Dolby Vision Profile 8.1 fails. Either first few frames then stops or green screen tearing and static.

Seems to be exactly this combo .mkv with DV (only have profile 8.1 to test with).

DV with .mp4 works fine and HDR10 on both containers works fine.

Playing .mkv + DV via USB doesn't trigger the DV or HDR toaster pop up so unsure if it's playing with either but it does play regardless.

ppskj178 commented 5 days ago

Have you tried to see if you can reproduce the same issue in other ways: plex, dlna, usb... If it's in mp4 format, I guess I can test it. Is this issue only happening with mkv?

USB is fine even with mp4 if I remember correctly, plex and dlna I haven't tested. I could test Plex, but I would have to reconvert a file to mp4.

If so, it sounds like it might be a remux issue. We might want to try raising an issue on the server side

GeorgeH005 commented 5 days ago

I had thought the same back then as well, but it was in a good enough point in my case, that it wasn't worth debugging the web client or server side. My suspicions lie on the client side. I will try to see if I find something worth exploring.

megosugit commented 5 days ago

How can I help on my side?

I can reproduce it easily, please let me know what kind of log could be interesting

gnattu commented 5 days ago

I am very certain it is a client specific issue and it is even webOS/TV model specific issue. The problem is some webOS TV model has a very buggy native HLS player that is unable to handle Dolby Vision correctly and that is what Jellyfin is using to do the on-the-fly remuxing to enable dolby vision. The problem is that:

Currently your best choice is to manually remux the file into mp4 if you want to keep dolby vision and make your TV happly. We can do little for this other than some very unfortunate option like "disable dolby vision for this TV" so that the server will send the mkv as-is and just play the HDR10 fallback.

The way to remux to mp4 is to jellyfin-ffmpeg (the upstream one may work worse), for example:

ffmpeg -i input.mkv -c:v copy -c:a copy -strict -2 out.mp4
GeorgeH005 commented 4 days ago

The problem seems to be that the hls player doesn't like not having the segments ready when seeking or resuming. If you look at the Jellyfin-web code, there was a hack for safari that made sure that there were segments available on playback start. By hacking that a bit to work on seek and on web0s (essentially forcing it to use live.m3u8 rather than master.m3u8) web0s can seek freely anywhere that has already been transcoded. This prevents the stall that we were seeing. Maybe we can introduce some kind of loading until there are segments ready instead of feeding it the url immediately and leaving it to handle it?

GeorgeH005 commented 4 days ago

This issue seems better suited to Jellyfin-web as this repo contains a wrapper that does not interfere with playback.

Acextreme1982 commented 3 days ago

I am very certain it is a client specific issue and it is even webOS/TV model specific issue. The problem is some webOS TV model has a very buggy native HLS player that is unable to handle Dolby Vision correctly and that is what Jellyfin is using to do the on-the-fly remuxing to enable dolby vision. The problem is that:

  • LG TVs won't play Dolby Vision in mkv, it will always use the HDR10 fallback
  • Some LG TV models do not handle Dolby Vision in HLS either, makes the server side remuxing also not working

Currently your best choice is to manually remux the file into mp4 if you want to keep dolby vision and make your TV happly. We can do little for this other than some very unfortunate option like "disable dolby vision for this TV" so that the server will send the mkv as-is and just play the HDR10 fallback.

The way to remux to mp4 is to jellyfin-ffmpeg (the upstream one may work worse), for example:

ffmpeg -i input.mkv -c:v copy -c:a copy -strict -2 out.mp4

Hmmm, ok, so I went and remux the .MKV file into MP4 using the above command you provided, using the ffmpeg in JellyFin's Server folder and absolutely no issues. I can see the dolby vision and dolby atmos popup on the top right hand corner of the TV when I play it with the JellyFin client on my LG G3 TV. So definitely it's an MKV + Dolby Vision problem in combination with LG TVs.

GeorgeH005 commented 3 days ago

I am very certain it is a client specific issue and it is even webOS/TV model specific issue. The problem is some webOS TV model has a very buggy native HLS player that is unable to handle Dolby Vision correctly and that is what Jellyfin is using to do the on-the-fly remuxing to enable dolby vision. The problem is that:

  • LG TVs won't play Dolby Vision in mkv, it will always use the HDR10 fallback
  • Some LG TV models do not handle Dolby Vision in HLS either, makes the server side remuxing also not working

Currently your best choice is to manually remux the file into mp4 if you want to keep dolby vision and make your TV happly. We can do little for this other than some very unfortunate option like "disable dolby vision for this TV" so that the server will send the mkv as-is and just play the HDR10 fallback. The way to remux to mp4 is to jellyfin-ffmpeg (the upstream one may work worse), for example:

ffmpeg -i input.mkv -c:v copy -c:a copy -strict -2 out.mp4

Hmmm, ok, so I went and remux the .MKV file into MP4 using the above command you provided, using the ffmpeg in JellyFin's Server folder and absolutely no issues. I can see the dolby vision and dolby atmos popup on the top right hand corner of the TV when I play it with the JellyFin client on my LG G3 TV. So definitely it's an MKV + Dolby Vision problem in combination with LG TVs.

LG TVs are UNable to playback Dolby Vision in MKV, neither with Jellyfin, nor with DLNA, not even with USB. That much we knew. The problem is that LG's hls player does not like not having fmp4 fragments ready as soon as it needs them it seems, which is a problem when we are transcoding/remuxing. The issue described here is reproducible even without dolby vision. I believe, apart from maybe implementing some extra loading in order to wait for the server to have some fragments ready, there is not much we can do.

megosugit commented 3 days ago

I'm not sure to understand. My LG TV can play DV in mkv very well with jellyfin, unless I skip ahead more than ~3min or if I resume a movie I already started.

Would it help if I try from a usb stick or with dlna to confirm if the issue is still present?

GeorgeH005 commented 3 days ago

I'm not sure to understand. My LG TV can play DV in mkv very well with jellyfin, unless I skip ahead more than ~3min or if I resume a movie I already started.

Would it help if I try from a usb stick or with dlna to confirm if the issue is still present?

Because we are remuxing on the fly to mp4 or ts respectively. If we weren't dolby vision would not be triggered. You can try it for yourself if you want with an mkv and a USB but there was a relevant pull request that had all the details regarding this.

ppskj178 commented 3 days ago

I am very certain it is a client specific issue and it is even webOS/TV model specific issue. The problem is some webOS TV model has a very buggy native HLS player that is unable to handle Dolby Vision correctly and that is what Jellyfin is using to do the on-the-fly remuxing to enable dolby vision. The problem is that:

  • LG TVs won't play Dolby Vision in mkv, it will always use the HDR10 fallback
  • Some LG TV models do not handle Dolby Vision in HLS either, makes the server side remuxing also not working

Currently your best choice is to manually remux the file into mp4 if you want to keep dolby vision and make your TV happly. We can do little for this other than some very unfortunate option like "disable dolby vision for this TV" so that the server will send the mkv as-is and just play the HDR10 fallback. The way to remux to mp4 is to jellyfin-ffmpeg (the upstream one may work worse), for example:

ffmpeg -i input.mkv -c:v copy -c:a copy -strict -2 out.mp4

Hmmm, ok, so I went and remux the .MKV file into MP4 using the above command you provided, using the ffmpeg in JellyFin's Server folder and absolutely no issues. I can see the dolby vision and dolby atmos popup on the top right hand corner of the TV when I play it with the JellyFin client on my LG G3 TV. So definitely it's an MKV + Dolby Vision problem in combination with LG TVs.

LG TVs are UNable to playback Dolby Vision in MKV, neither with Jellyfin, nor with DLNA, not even with USB. That much we knew. The problem is that LG's hls player does not like not having fmp4 fragments ready as soon as it needs them it seems, which is a problem when we are transcoding/remuxing. The issue described here is reproducible even without dolby vision. I believe, apart from maybe implementing some extra loading in order to wait for the server to have some fragments ready, there is not much we can do.

This inspired me to test it out and I found a workaround.

When remuxing, I wait until the orange gauge on the dashboard is full before I change the playback location. This worked for me.

If anyone else is like me, it would be a huge help right now if this orange bar could be displayed in the client as well.

ppskj178 commented 3 days ago

I am very certain it is a client specific issue and it is even webOS/TV model specific issue. The problem is some webOS TV model has a very buggy native HLS player that is unable to handle Dolby Vision correctly and that is what Jellyfin is using to do the on-the-fly remuxing to enable dolby vision. The problem is that:

  • LG TVs won't play Dolby Vision in mkv, it will always use the HDR10 fallback
  • Some LG TV models do not handle Dolby Vision in HLS either, makes the server side remuxing also not working

Currently your best choice is to manually remux the file into mp4 if you want to keep dolby vision and make your TV happly. We can do little for this other than some very unfortunate option like "disable dolby vision for this TV" so that the server will send the mkv as-is and just play the HDR10 fallback.

The way to remux to mp4 is to jellyfin-ffmpeg (the upstream one may work worse), for example:

ffmpeg -i input.mkv -c:v copy -c:a copy -strict -2 out.mp4

@gnattu As you said, I will try to use the mp4 format in the future. Do you think this will work with other clients?

I'd like to know if the LG TV is the most picky device. If you know of other types of clients that are picky about media files, please let me know

gnattu commented 3 days ago

As you said, I will try to use the mp4 format in the future. Do you think this will work with other clients?

mp4 has much better compatibility in general as mkv is a very complex container.

I'd like to know if the LG TV is the most picky device. If you know of other types of clients that are picky about media files, please let me know

There are a lot of picky devices for direct play, but for most of them Jellyfin could do on-the-fly remuxing to make it work without a transcoding, and the HLS player quirks is what makes it work badly on LG TVs.

ppskj178 commented 3 days ago

As you said, I will try to use the mp4 format in the future. Do you think this will work with other clients?

mp4 has much better compatibility in general as mkv is a very complex container.

I'd like to know if the LG TV is the most picky device. If you know of other types of clients that are picky about media files, please let me know

There are a lot of picky devices for direct play, but for most of them Jellyfin could do on-the-fly remuxing to make it work without a transcoding, and the HLS player quirks is what makes it work badly on LG TVs.

thnak you

Acextreme1982 commented 3 days ago

I am very certain it is a client specific issue and it is even webOS/TV model specific issue. The problem is some webOS TV model has a very buggy native HLS player that is unable to handle Dolby Vision correctly and that is what Jellyfin is using to do the on-the-fly remuxing to enable dolby vision. The problem is that:

  • LG TVs won't play Dolby Vision in mkv, it will always use the HDR10 fallback
  • Some LG TV models do not handle Dolby Vision in HLS either, makes the server side remuxing also not working

Currently your best choice is to manually remux the file into mp4 if you want to keep dolby vision and make your TV happly. We can do little for this other than some very unfortunate option like "disable dolby vision for this TV" so that the server will send the mkv as-is and just play the HDR10 fallback. The way to remux to mp4 is to jellyfin-ffmpeg (the upstream one may work worse), for example:

ffmpeg -i input.mkv -c:v copy -c:a copy -strict -2 out.mp4

Hmmm, ok, so I went and remux the .MKV file into MP4 using the above command you provided, using the ffmpeg in JellyFin's Server folder and absolutely no issues. I can see the dolby vision and dolby atmos popup on the top right hand corner of the TV when I play it with the JellyFin client on my LG G3 TV. So definitely it's an MKV + Dolby Vision problem in combination with LG TVs.

LG TVs are UNable to playback Dolby Vision in MKV, neither with Jellyfin, nor with DLNA, not even with USB. That much we knew. The problem is that LG's hls player does not like not having fmp4 fragments ready as soon as it needs them it seems, which is a problem when we are transcoding/remuxing. The issue described here is reproducible even without dolby vision. I believe, apart from maybe implementing some extra loading in order to wait for the server to have some fragments ready, there is not much we can do.

I am not quite sure I understand you. Why is LG's HLS player being brought up? I am using Jellyfin's app on my TV to connect to my Jellyfin server to play the mkv files. Is the Jellyfin app actually using the HLS player to play the on-the-fly remux files?

GeorgeH005 commented 3 days ago

@gnattu Changing one line in the web client to make webOS use hls.js seems to work well! Under direct play conditions dolby vision is triggered as usual, and when forcing a transcode or a remux, seeking works well even with fmp4. If you have any thoughts on what should be changed/tested I would be happy to help! It seems like a good solution for now.

gnattu commented 3 days ago

Changing one line in the web client to make webOS use hls.js seems to work well

We were not using HLS.js for a reason as some models works exceptionally bad with that.

gnattu commented 3 days ago

I am not quite sure I understand you. Why is LG's HLS player being brought up? I am using Jellyfin's app on my TV to connect to my Jellyfin server to play the mkv files. Is the Jellyfin app actually using the HLS player to play the on-the-fly remux files?

Because LG TVs cannot play Dolby Vision as Dolby Vision in mkv, so the server has to remux it, and the remux is delivered with HLS, which uses native HLS player of the LG TV.

GeorgeH005 commented 2 days ago

Changing one line in the web client to make webOS use hls.js seems to work well

We were not using HLS.js for a reason as some models works exceptionally bad with that.

That's a shame, could still be a solution for newer models.