Kodi Community Forum

Full Version: Subtitle previous/next line
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hello,

does XBMC provide some means to jump to the next/previous line in a subtitle in the movie? Like mplayer `g` (previous line in subtitle) and `y` (next line in subtitle) sub delay keys? It is very very very useful when the subtitles are out of synch...

I know that there is a way to adjust the subtitle offset in XBMC, but it is not as useful as the mplayer sub delay, because:

1) it does not have a keyboard shortcut - I think that is not an issue and could be solved just with configuration...

2) it is to adjust the subtitle delay, not to jump to the next subtitle in just the right moment, adjusting the delay accordingly.

I hope that this functionality already exists in XBMC, and is just hidden in some configuration... I am already addicted to XBMC, watching 90% of my tv series in it, but for the remaining 10% I have to resort to smplayer for this feature only... Hope someone helps me!

Thanks in advance
Nope, it doesn't exist. I'm not sure how easy it would be with our current subtitling system to get the information out.

The keymapping stuff for subtitle delay exists - there's SubtitleDelay (pops up a slider in skins that support it - eg PM3.HD) SubtitleDelayPlus,SubtitleDelayMinus.

If you think up a good key for SubtitleDelay, I'm happy to add it to the defaults.

Cheers,
Jonathan
Wow! Thanks for the lightspeed fast response! Sad it doesn't exist, but very happy with the XBMC subtitle system - clear and steady subtitles.

As for the keys, I think that any two keys near to each other should do. I`m not particularly happy with the `g`/`y` combination that mplayer uses for prev/next line... Perhaps `{` and `}` could be a good choice for SubtitleDelayMinus/SubtitleDelayPlus (hoping that someday '[' and ']' could be mapped to SubtitlePrevLine/SubtitleNextLine ;-) ).

I do (humbly) have some programming expertise (C++ mainly, just learning Python...) I have never even seen XBMC source code, but do you think it could be a task for a newbie contributor to XBMC? Or it is too much pretentious? In my noobieness, I think something like "subtitleDelay = subtitleTime[currentSubtitle + 1] - currentPlayingTime;" could be the logic to the implementation for SubtitleNextLine... Well, ok, I will study XBMC code now.
I believe the subtitles (at least the text based ones - remember there's .ass/ssa and .ifo/sub which are effectively bitmap as far as rendering them goes) are fetched from the player in GUIWindowFullScreen.cpp - the function is RenderTTFSubtitles if memory serves. Following from there down into the player will give you some idea of whether you can get previous or next lines from the subtitle parsers - I'm not sure whether you can or not. I think this would be something manageable to someone like yourself - at least the investigation stages.

Note that we just need a single key for "SubtitleDelay" as that pops up a slider which allows left/right delay and advance.

Good luck,
Jonathan
Jonathan, your memory is sharp... But it seems a bit more difficult than I expected. I am thinking about writing a method GetNextSubtitleTime() using CDVDPlayerSubtitle::GetCurrentSubtitle() as a model, and then set the subtitle delay just like I said above. Do you know what means the pts parameter to this method? Is it a time?

My vote for the subtitle delay key is 'd', just next to 's' and meaning 'delay' (if not used yet...)
At a guess, pts stands for "packet time stamp". What units this is in I have no idea, having not played around in dvdplayer land for quite some time.

Your approach seems reasonable enough. An alternative might be to instruct the player to delay the subs, and then get the subs delay for saving. Much of a muchness (and easy to change between the two) so nothing to concern yourself with!

Cheers,
Jonathan
Sorry, I give up... All I got was to introduce bugs... Hope some day I try again... Anyway, thanks again! XBMC rocks!