aajanki / yle-dl

Download videos from Yle servers
https://aajanki.github.io/yle-dl/index-en.html
GNU General Public License v3.0
309 stars 51 forks source link

Subtitles timing is off #360

Open svalavuo opened 3 months ago

svalavuo commented 3 months ago

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.

aajanki commented 3 months ago

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 commented 3 months ago

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 commented 3 months ago

@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 commented 3 months ago

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

svalavuo commented 3 months ago

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 commented 3 months ago

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 commented 3 months ago

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 commented 3 months ago

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 commented 3 months ago

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 commented 2 months ago

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 commented 2 months ago

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 commented 2 months ago

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 commented 2 months ago

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 commented 5 days ago

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.