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

[Issue]: Sub title desync JF 10.8.9 #4346

Open
1 task done
MrToast99 opened this issue Jan 27, 2023 · 36 comments
Open
1 task done

[Issue]: Sub title desync JF 10.8.9 #4346

MrToast99 opened this issue Jan 27, 2023 · 36 comments
Labels
bug Something isn't working

Comments

@MrToast99
Copy link

MrToast99 commented Jan 27, 2023

Please describe your bug

Upgraded 10.8.8 > 10.8.9 and now subtitles desync or loop if you jump ahead in a file.

Steps:
Start a show with subs,
Jump ahead a few mins

This will cause the subs to loop the last 2 or 3 lines constantly.

Turning off subs and back on will resume the subs but they will be desync'd by 2-3 secs. This persists even if playback is stopped and started again.

Jellyfin Version

10.8.0

if other:

No response

Environment

- OS: Windows server 2016
- Virtualization: 
- Clients: browser
- Browser: Chrome
- FFmpeg Version:5.1.2
- Playback Method:
- Hardware Acceleration: no
- Plugins: playback reporting, reports
- Reverse Proxy: yes
- Base URL: /jellyfin
- Networking: NAT
- Storage:NFS

Jellyfin logs

No response

FFmpeg logs

No response

Please attach any browser or client logs here

No response

Please attach any screenshots here

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct
@MrToast99 MrToast99 added the bug Something isn't working label Jan 27, 2023
@poulpor
Copy link

poulpor commented Jan 27, 2023

I think I might have the same problem, or somewhat related but I thought it was because of intro-skipper plugin so I opened an issue on ConfusedPolarBear's project. On my setup, only ASS subs are subject to this behavior, it restarts from the beginning of the subtitle file after the intro is skipped. 10.8.8 was doing fine.
If you can, could you try the new AndroidTV client 0.15.3, changing the player to libvnc and check if the problem persists?

@soultaco83
Copy link

soultaco83 commented Jan 28, 2023

I am seeing this issue as well on 10.8.9. The subtitles are getting out of sync. Turning them off and on again will fix for a few minutes but then proceeds to go out of sync again. I have reverted to 10.8.8 for the time being. Subtitles are working again without issue. I was using Chrome and Edge to test with.

@dmitrylyzo
Copy link
Contributor

dmitrylyzo commented Jan 28, 2023

  1. What is the subtitle format (ASS/SRT/PGS)?
  2. Are the subtitles forced to be burnt-in (encoded in video)?
  3. How is the video played (DirectPlay/Remux/DirectStream/Transcode)?
    FFMpeg logs can also be useful (if it is not DirectPlay).
  4. Is subtitles offset used?

@MrToast99
Copy link
Author

  1. What is the subtitle format (ASS/SRT/PGS)?

    1. Are the subtitles forced to be burnt-in (encoded in video)?

    2. How is the video played (DirectPlay/Remux/DirectStream/Transcode)?
      FFMpeg logs can also be useful (if it is not DirectPlay).

    3. Is subtitles offset used?

  1. impacts ASS, SRT seems fine
  2. Yes
  3. remux
  4. no
    FFmpeg.Remux-2023-01-28_08-44-14_45314a29122bc7db3fd72ceabd9e2390_bf4c71d5.log

@dmitrylyzo
Copy link
Contributor

dmitrylyzo commented Jan 28, 2023

I guess Burn subtitles is set to Auto. Otherwise it would be Transcoding, not Remux.
In this case, ASS subs are rendered by JSO (client-side). Since we are using the "renderAhead" mode (cache with timestamps), the error could be due to incorrect timestamps when remuxing (ffmpeg) or possibly a problem with hls.js.

According to the log, you are using fMP4. Does desync occur when using TS (disable fMP4)?
This is "Progressive MP4".

UPD:
It doesn't seem to work with "Progressive MP4". To reproduce, I had to disable HLS in the web source - don't know how to correctly force progressive mp4.
Each time you fast-forward/rewind/seek, subs starts from the beginning because the player is reporting the wrong timestamp.
It probably started after #4182

@MrToast99
Copy link
Author

After looking into your mention of HLS and finding to "Codec Support" article I see that Chrome is marked as no MKV HLS support, where Edge is supported. I tested by continuing played back of a file and jumped around the timeline, the subs loaded perfectly fine.

I did note the sub desync on android a few months back (could correlate to 4182) but I don't playback on android to frequently.

@dmitrylyzo
Copy link
Contributor

After looking into your mention of HLS and finding to "Codec Support" article I see that Chrome is marked as no MKV HLS support, where Edge is supported. I tested by continuing played back of a file and jumped around the timeline, the subs loaded perfectly fine.

Chrome doesn't support the MKV container (the HLS protocol is irrelevant here) and must be remuxed to a supported container. In most cases, it is TS which is streamed via HLS (HLS-TS). You can also enable HLS-fMP4, where the container is MP4, but it will still be transmitted as fragments.
Btw, the subtitles seem to work fine with HLS-TS and HLS-fMP4.

In Edge MKV plays as DirectPlay (over HTTP(S) protocol) with correct timestamps.

I did note the sub desync on android a few months back (could correlate to 4182) but I don't playback on android to frequently.

In the Android app, you can enable different players, so there are more variables.

The current problem occurs only when "Progressive MP4" comes into play. This is normal MP4 over HTTP(S) protocol. It was enabled in 10.8.9 (in #4182) when WebM was replaced with MP4, so StreamBuilder can now use this profile when remuxing or transcoding is needed.
I don't know how to get it to be selected, but that's what you have in your log.

What's really going on
When you seek, the server starts a new transcoding job - it literally cuts the part from the beginning. In the client (Chrome in your case), the timestamps start at zero (because they have not been saved). There is an offset (seeking position), but it doesn't apply, and the JSO gets them wrong.
The reason why it doesn't apply is that the duration of the cut file starts from a small value, and this condition is then incorrect.

To force progressive MP4, I added options.enableHls = false; before this line.

During testing I noticed that ffmpeg doesn't preserve the requested time, so we can't just add an offset - we need to know the actual offset.
I was suggested to use -copyts (to ffmpeg command) and that seemed to work, but in this case we don't need to add an offset, and I'm not sure if it doesn't harm other cases.

@poulpor
Copy link

poulpor commented Jan 29, 2023

Thank you for your researches and the explanation, I suppose it goes the same when, using a web browser like Chrome or Edge and the file is remuxed, the extension intro-skipper does its job and seeks few seconds/minutes ahead: the subtitle then restarts from the beginning.
I don't know what web player is used in the Jellyfin Android client, but it acts the same. Exoplayer doesn't play the file and external player works fine but not intro-skipper, which becomes inoperative.

obviously, the problem is not present when the video with ASS sub is directplay, for example by Jellyfin Mac client (which rely on MPV video player), the subs are perfectly synced after intro skipped by the plugin or seeking back and forth.

I hope there will be an easy fix.

@anthonylavado anthonylavado transferred this issue from jellyfin/jellyfin Feb 12, 2023
@cbeamond
Copy link

We've been looking into this at jellyfin/jellyfin#8403. This issue here has some small differences, but it may help figure out some of the problems with the information found in that thread.

@MrToast99
Copy link
Author

MrToast99 commented Apr 24, 2023

Updated to 10.8.10 and this longer seems to an issue...

I'm guessing due to jellyfin/jellyfin-web#4362 or jellyfin/jellyfin-web#4385

@dmitrylyzo
Copy link
Contributor

I'm guessing due to jellyfin/jellyfin-web#4362 or jellyfin/jellyfin-web#4385

#4385

@jellyfin-bot

This comment has been minimized.

@jellyfin-bot jellyfin-bot added the stale No activity for an extended length of time label Aug 23, 2023
@AIndoria
Copy link

AIndoria commented Aug 29, 2023

This remains an issue. Not stale. Subs get desynced when seeking, turning them off and on has no impact. I usually have to force stop and clear cache for it to work again. Incredibly annoying on android/android-tv.

@dmitrylyzo
Copy link
Contributor

This remains an issue. Not stale. Subs get desynced when seeking, turning them off and on has no impact. I usually have to force stop and clear cache for it to work again. Incredibly annoying on android/android-tv.

The problem was originally caused by progressive remuxing, which was dropped in web 10.8.10.
But Android probably still has a progressive profile. 🤔
AndroidTV doesn't use web, so that's a different story.

Please answer same questions: #4346 (comment)
+ What player do you use on Android?

@AIndoria
Copy link

AIndoria commented Aug 29, 2023

Please answer same questions: #4346 (comment)

  • What player do you use on Android?

Android Says Web Player. On Android TV Both Exo and libVLC have the same issue (libVLC to a ...lesser extent but it is there). Forcing the video to open in an external player such as MX tends to solve the issue almost completely at times.

  • What is the subtitle format (ASS/SRT/PGS)?

ASS plays just fine. SRT/PGS have issues, and it's not all of them. Some of them at times have issues. Others play fine. I am trying to pinpoint exactly what files are having the issue.

  • Are the subtitles forced to be burnt-in (encoded in video)?

No

  • How is the video played (DirectPlay/Remux/DirectStream/Transcode)?

DirectPlay

  • Is subtitles offset used?

Nope, synced with Bazarr (work perfectly on actual jellyfin-media-player).

@jellyfin-bot jellyfin-bot removed the stale No activity for an extended length of time label Aug 30, 2023
@danielwikander
Copy link

Do we have any idea what could be causing this, or where in the codebase one could start looking? This issue is bothering me so much I might try looking into it myself, but I'm new to the project so any guidance here would be appreciated.

@Migs3
Copy link

Migs3 commented Mar 20, 2024

Is this still being looked into? This is one of the most annoying things "wrong" with jellyfin. It doesn't seem like a difficult concept to simply use a single time value for displaying the video and subtitles. I don't know the underlying code or anything but it seems like the only way this could be a problem is if there are multiple time values that are needing to be kept in sync when there really should only be one time value when serving content.

Not only the above, but on a related note there should be a menu option in the gui/web to set a subtitle sync time value (+/-). A simple method to time shift the subtitles ahead or behind slightly. Not only would that help negate some of the frustration of this issue, but some subtitles are just slightly off when you have different media/subtitle releases that don't quite match up.

@dmitrylyzo
Copy link
Contributor

Is this still being looked into? This is one of the most annoying things "wrong" with jellyfin. It doesn't seem like a difficult concept to simply use a single time value for displaying the video and subtitles. I don't know the underlying code or anything but it seems like the only way this could be a problem is if there are multiple time values that are needing to be kept in sync when there really should only be one time value when serving content.

The original issue has been fixed by #4385
If you have steps to reproduce your case, post them (what client, what subtitles type, etc.).
Maybe even open a new issue (it may be different from the original one).

Not only the above, but on a related note there should be a menu option in the gui/web to set a subtitle sync time value (+/-). A simple method to time shift the subtitles ahead or behind slightly. Not only would that help negate some of the frustration of this issue, but some subtitles are just slightly off when you have different media/subtitle releases that don't quite match up.

It is in the Player Settings (gear button) / Subtitle Offset.

@Ellypax
Copy link

Ellypax commented Mar 22, 2024

Hello, I'm experiencing ongoing issues with Jellyfin 10.8.13 running on Linux Docker x64. Specifically, I'm encountering varying subtitle offsets depending on the file. This problem persists across multiple files sourced from different origins. Each time, the subtitles fail to synchronize properly, and notably, the desynchronization tends to increase as the movie progresses.

This issue occurs specifically with integrated subtitles when accessed via Jellyfin web interface. I've been primarily using Safari on MacOS 14.4 and iOS 17.4.1 for playback.

Interestingly, when I utilize Jellyfin for Android TV with libVLC, there are no subtitle synchronization issues. Additionally, downloading the file and playing it on my computer also does not reproduce the problem.

@Migs3
Copy link

Migs3 commented Mar 23, 2024

The original issue has been fixed by #4385 If you have steps to reproduce your case, post them (what client, what subtitles type, etc.). Maybe even open a new issue (it may be different from the original one).

It is in the Player Settings (gear button) / Subtitle Offset.

Maybe this is specific to the Android TV client, It's mainly used on our Firestick at home and my GF insists on constantly bashing my "new media server" due to subtitles never being correct and that she always has to turn them off.

@cthulhuz
Copy link

cthulhuz commented Apr 4, 2024

Can confirm that this bug is present on Samsung TV (Tizen) running jellyfin-web. The subtitles work fine on other devices and players. Bug occurs when seeking in some files that are being direct played with SRT subtitles. Direct playing a file from the beginning works fine until you seek in it.

@joost00719
Copy link

d players. Bug occurs when seeking in some files that are being direct played with SRT subtitles. Direct playing a file from the

Same here. VLC player also isn't a proper fix. It does fix the sync issues, but the content will be resized to fit the screen, and since almost no movie is 16:9, it will stretch almost all content. Also, it suffers from stutters and audio pops (chrome cast with android tv. version "jellfyin-androidtv 0.16.7 release").

@thornbill
Copy link
Member

AndroidTV doesn't use web, so that's a different story.

As Dmitry already pointed out, if you are having issues with the Android TV app this is not the correct place.

@random-human-being
Copy link

I have also just experienced it in 10.9 with SRT subs, after skipping ahead. The video was being transcoded.

Switching to PGS subs forced them to be burned into the video, fixing the issue.

@SpyrosRoum
Copy link

I've started experiencing this on 10.9, while before (<10.9) it only happened on mobile clients, now it happens on the web too.
Is there any possible workaround or anything? It's extremely annoying, especially since the only "fix" I have found is to download the video locally

@Kusefiru
Copy link

I am noticing similar behavior on jellyfin-web 10.9.2 with Firefox 126.0.
The subtitle synchronisation is correct at first, but get worst with time or when jumping in the file.

I have tested both embedded ASS subs and external SRT subs.

If I switch to Edge (125.0.2535.51), the subtitles are correctly synced. This is also the case when playing the video file directly on my computer, so I believe the subtitles in themselves are fine.

@fungos
Copy link

fungos commented Jun 2, 2024

Same issue here with Roku client, LGTv client and FireTV client.

srt subtitles, some start correct and desync as it progress, most desync after a pause-quit-resume, some are just completely desync from start. It was ok with server 10.8.something, but 10.9 is becoming almost unusable unfortunately, forcing me back to Plex to be able to watch almost anything, which means the subtitles are perfect and the problem is with Jellyfin, not sure if entirely server side or both sides.

@SpyrosRoum
Copy link

Something I've noticed and helps a little is that using the https://github.com/jellyfin/jellyfin-vue web client seems to fix the issue for items that have de-synced on the main web client.
Unfortunately this is not a complete solution since the vue client still misses features, but it saves me from having to download anything that I was watching and is broken...

@deniax2
Copy link

deniax2 commented Jun 5, 2024

Interestingly enough, for me using Swiftfin always has synced subtitles. Doesnt matter if i scrub throught the movie or change the language of the sub.

When I switch to my laptop with Chrome or Firefox, the subtitles are always desynced. I can sync them manually, but the moment I fast-forward or reverse, the subs are de-synced again.

So it really seems for me a client issue

@viown
Copy link
Contributor

viown commented Jun 5, 2024

Interestingly enough, for me using Swiftfin always has synced subtitles. Doesnt matter if i scrub throught the movie or change the language of the sub.

When I switch to my laptop with Chrome or Firefox, the subtitles are always desynced. I can sync them manually, but the moment I fast-forward or reverse, the subs are de-synced again.

So it really seems for me a client issue

This is because Swiftfin direct-plays nearly all types of media without issues, while Chrome and Firefox have a more limited codec support which in your case is leading to direct-streaming or transcoding (which is what causes this issue).

This issue is almost purely server-side because the server cannot deliver the exact timestamp the client is asking for. Instead, the server will seek back to the earliest keyframe (which can be anywhere from 5-8 seconds wide) causing the de-sync.

Although I'm sure this could be fixed with some new API introductions where the server is able to tell the client the exact timestamp it's seeking to, but that requires explicit client support and there could be some other complications I'm missing. Maybe @gnattu could explain?

@SpyrosRoum
Copy link

@viown what you are saying is interesting but it raises the question, why did it become a bigger problem with v10.9? Something must have changed in the backend and perhaps it's possible to revert or fix that without breaking/client changes

@gnattu
Copy link
Member

gnattu commented Jun 8, 2024

why did it become a bigger problem with v10.9

it is not. This issue was created for 10.8 isn't it?

@SpyrosRoum
Copy link

The issue was created for 10.8, but it didn't happen for me (on firefox) until 10.9, and based on the activity on the issue I believe other experienced the same.

To be clear I had experienced it before on the mobile (android, default player), but never on firefox.

@creekdrops
Copy link

Not sure if this issue is related, but I've noticed that when accessing subtitles over HLS using Apple's native player in Mac and iOS, the subtitles are extremely delayed by about 12 seconds.

@finnurthorisson
Copy link

Also happening for me with 10.9.6 and 10.9.7 in Firefox but did not happen in 10.8.10

Transcoded (HEVC->H264) in browser is desynced but in app (Direct playing) it works like normal. I've also had it occasionally replay a short chunk in browser which usually triggers it to desync. Desync persists when leaving and resuming

@aykutcan
Copy link

I am having problems with embedded subtitles. (Various formats, Various Browsers).

When I seek while playing a video, the subtitle is desycing.

I am using Docker and No HW Acceleration (Do not judge me pls. I cant find any low bracket gpu yet)

Server version 10.9.8
Web version 10.9.8
Build version 10.9.8

Web Chrome: Broken
Web Firefox: Broken
Tizen Client : OK
Android TV Client: OK
Android Client : OK

I didn't try with DLNA (Because DLNA plugin is completely broken) but at this point it is obvious that it is a web client problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests