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

Subtitles timing is off #360

Open
svalavuo opened this issue Jun 12, 2024 · 17 comments
Open

Subtitles timing is off #360

svalavuo opened this issue Jun 12, 2024 · 17 comments

Comments

@svalavuo
Copy link

Is it just me and my setup or does the latest yle-dl (20240429) make subtitles appear earlier than they should?
Tried with Vera Stanhope (https://areena.yle.fi/1-2503613) all episodes. And same with Roy Grace (https://areena.yle.fi/1-50791118) all episodes.

  • Samuli
@aajanki
Copy link
Owner

aajanki commented Jun 13, 2024

I confirm that the subtitles seem to appear a few seconds too early. I tested on VLC and on SMPlayer. When played on Areena on the web browser, the subtitle timing seems much better.

Not currently sure what is causing this. It might be that there is some kind of subtitle timing offset that does not get applied correctly on the downloaded video file.

@svalavuo
Copy link
Author

I forgot to tell which players I used, but VLC and Jellyfin (both client application and web client) behaved the same. Quite odd, that previous showings of the same episodes worked fine.

@IlmariKu
Copy link

@svalavuo I had the exact same issue with a series. Did you download the Vera Stanhope as series? I noticed with independent files they seemed to be on time, but with series, lagging for few seconds. I'm also using Jellyfin.

@svalavuo
Copy link
Author

@IlmariKu Ah, ok. I downloaded both those series as series. I have to try to download as individual episodes. Thanks for the tip!

@svalavuo
Copy link
Author

Ok. That didn't help in my case. :-( When I downloaded those as series, subtitles were a bit early. Now that I downloaded those as individual episodes, subtitles are a bit late.

@IlmariKu
Copy link

I wonder @svalavuo, if you execute the command with --showmetadata-flag, it should give you the direct url of subs as a link to Areena CDN. If you download those subs, are they on-time with the video?

@svalavuo
Copy link
Author

There is something funny going with Areena. :-)
When I execute command yle-dl --showmetadata https://areena.yle.fi/1-67480272 (Roy Grace S04E01), there is this: "subtitles": []
And at the very beginning there is an error row: [hls @ 0xe9ac40] Can't support the subtitle(uri: ../hdntl=exp=...

@aajanki
Copy link
Owner

aajanki commented Jun 17, 2024

Not all videos have external subtitle files. It seems that especially recent Areena programs do not have external subtitles anymore.

Embedded subtitles do not show up in the --showmetadata output, only external subtitles when they are available.

It is safe to ignore the "Can't support the subtitle" warning. Ffmpeg outputs it on all Areena streams but still downloads the (embedded) subtitles.

@svalavuo
Copy link
Author

There is no fix for this?
I was thinking that this might work if I rip the subtitles from mkv and try to fix the timing of this external subtitle and leave it external (and disable the embedded track) or embed it back to mkv, That would take a huge amount of time with only one season of one series. :-(

@IlmariKu
Copy link

IlmariKu commented Jul 4, 2024

I'll test this a bit. I think the list of things to figure out are:

  1. Is subtitle-delay repeatable, consistent across different devices and downloads?
  2. Are extracted subtitles delayed by default as well?

EDIT: Answer to number 2 is yes, same delay on embedded vs. extracted with ffmpeg.

To answer number 1:

This film:
https://areena.yle.fi/1-65235605 - there was exactly -2.0 second delay. I fixed it with https://subshifter.bitsnbites.eu/

Also, one another movie had exactly same -2.0sec delay subtitles. Is there a theme here? Can you download that file @svalavuo and test if you have the same delay? Fixed the sub timing with +2.0s delay

Third example, https://areena.yle.fi/1-66395414, this film, also -2.0 second delay. Fixed by adding +2.0s to it

If we can find a pattern, maybe we can do something about it.

@svalavuo
Copy link
Author

Now, what I have tried with, they are all quite close two seconds early. So I delayed subtitles that 2 seconds with mkvtoolnix. Seems to work.

@IlmariKu
Copy link

Which hardware / OS are you running? I'm using Raspberry pi with Ubuntu. I wonder if the 2 seconds is caused by something related to yle-dl or maybe some slowness in hardware.

@svalavuo
Copy link
Author

svalavuo commented Jul 14, 2024

Apparently my answer wasn't saved earlier. :-(
I use mainly Asustor AS4604T NAS and Odroid M1. Both do the same: video saves nicely and subtitles timing is about exactly two seconds off. I use Subtitle Edit to determine the offset and then MKVToolNix to insert delay to subtitle track.
The subtitle delay appears with every player I have tried: Jellyfin, VLC and Kodi. There might be some other players as well, but all of them doesn't support included subtitles but would like to have them external.

I was wondering if there is some kind of timing information delivered with the video, because browsers play them just fine.

@IlmariKu
Copy link

Yeah, it's strange, I'm experiencing the exact same behavior of 2 second delay with subtitles.

I need to personally get this fixed, so I also don't have to open up programs to manually adjust subtitles. I'll see if I find something and let the thread know.

@j57m-yh
Copy link

j57m-yh commented Oct 13, 2024

Same problem here. For me it seems that all downloads have subs 2 seconds early. Of course they can be delayed in player options, but as you need to do that every time starting to watch one of these downloads, it's a bit annoying.

In ffmpeg command line options list there is (quote):
"-itsoffset offset (input) Set the input time offset.
offset must be a time duration specification, see (ffmpeg-utils) the Time duration section in the ffmpeg-utils(1) manual.
The offset is added to the timestamps of the input files. Specifying a positive offset means that the corresponding streams are delayed by the time duration specified in offset."

Could this be a way to modify the timing of subtitle stream(s) if I knew (which I obviously do not) how to feed it to ffmpeg?

@andeem
Copy link

andeem commented Dec 15, 2024

Subtitle timing seems to be still off.

I ran yle-dl with -VV flag and did notice something that might be relevant.
In the output, there's this ffprobe(?) line:
Duration: 00:29:10.04, start: 2.000000, bitrate: 0 kb/s
The start value seems to correlate with the subtitle offset. I tested with few episodes/movies and those that were published to Areena quite recently (earliest was at the start of August 2024) did have the 2 second offset.

But then this one https://areena.yle.fi/1-64122776, published at February 2024, had different offset.
Duration: 00:44:55.14, start: 0.101000, bitrate: 0 kb/s
Subtitles seem to be slightly off, but 0.1s is so small offset that it's hard to tell.

EDIT:
I tested with some older videos I found and they had same 0.1s offset. Looks like something changed at some point between April and August 2024. Older videos have 0.1s offset and newer 2s.

@j57m-yh
Copy link

j57m-yh commented Dec 15, 2024

Some observations about subtitle timing vs. publish date:
2023-04-17 subs ok
2023-07-31 subs early
2024-01-04 subs ok
2024-02-08 subs ok
2024-09-09 subs early.
What programs those actually were - sorry, didn't write those down, can't remember anymore...
Anyway, it seems the publishing date cannot be trusted in judging, whether the timing is OK or not.

The ffmpeg -itsoffset command line option added to the actual download command sent to ffmpeg corrected the timing at download, I tested that. But then you would need to know in advance if there is a timing "error" in the stream - and because publishing date gives no reliable clue of that, you'll have to download first to be able to check. So, not very useful.

I noticed that "start: n.nnn" in the -VV output also, but for some reason I assumed it's the time the first sub line appears counted from the start of the video and didn't check it any further. So this is still only guessing.

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

No branches or pull requests

5 participants