Skip to content
This repository has been archived by the owner on Feb 6, 2022. It is now read-only.

Wrong order of dialogues #49

Closed
Dador opened this issue Aug 1, 2015 · 4 comments
Closed

Wrong order of dialogues #49

Dador opened this issue Aug 1, 2015 · 4 comments
Milestone

Comments

@Dador
Copy link
Contributor

Dador commented Aug 1, 2015

In libjass:
2015-08-01_21-28-50

In Aegisub (libass):
25_001_0

Test script:

[Script Info]
Title: 
ScriptType: v4.00+
WrapStyle: 0
PlayResX: 1280
PlayResY: 720
Scroll Position: 0
Active Line: 0
Video Zoom Percent: 1
ScaledBorderAndShadow: yes

[V4+ Styles]
Format: Name, Fontname, Fontsize, PrimaryColour, SecondaryColour, OutlineColour, BackColour, Bold, Italic, Underline, StrikeOut, ScaleX, ScaleY, Spacing, Angle, BorderStyle, Outline, Shadow, Alignment, MarginL, MarginR, MarginV, Encoding
Style: Default,Trebuchet MS,54,&H00FFFFFF,&H000000FF,&H00020713,&H00000000,-1,0,0,0,100,100,0,0,1,2.55,0,2,0,0,42,1

[Events]
Format: Layer, Start, End, Style, Name, MarginL, MarginR, MarginV, Effect, Text
Dialogue: 0,0:00:00.00,0:00:03.00,Default,,0,0,0,,Should be on bottom 1
Dialogue: 0,0:00:00.00,0:00:03.00,Default,,0,0,0,,Should be on top 1
Dialogue: 0,0:00:04.00,0:10:00.00,Default,,0,0,0,,Should be on bottom 2
Dialogue: 0,0:00:05.00,0:10:00.00,Default,,0,0,0,,Should be on top 2

P.S. Test almost the same as #48 but this issue about different thing so I decided to put it in separate issue.

@Arnavion
Copy link
Owner

Arnavion commented Aug 1, 2015

Yes, currently the renderer always appends new subs to the layer div, so new subs always appear in document order (i.e., below) existing subs.

Is it okay to just reverse this for the layer1-3 divs - use insert instead of append? Or is there something else to consider?

@Dador
Copy link
Contributor Author

Dador commented Aug 2, 2015

First dialogues ordered by "start time" (the earliest dialogue would be at the bottom).
If there are dialogues with the same "start time", then order by position in script (the dialogue that closest to beguining whould be at the bottom). Script to test that.

I don't think that thing with time important for common dialogues. But maybe it can be important for typesetting (for example when one dialogue "moves" another).
Time already half-considered in libjass (just by fact that we append dialogue on start time). Why half? If click "pause" and then "play" again (i.e. dialogues re-rendered?) subtitles re-ordered without considering time.

In other words, "just reverse" would help in most cases. What to do with time - it is your choise :)

@Arnavion
Copy link
Owner

Arnavion commented Aug 3, 2015

Sorting by start time is technically not right. Eg: dialogue1 is from 2s to 7s and dialogue2 is from 1s to 5s. If seeking to 3s, then d1 should show before d2 (assuming \an2, d1 should be below d2). However if you play the video with vsfilter from 0s to 3s you will see it put d2 below d1, which is because of three reasons:

  • Since at 1s vsfilter already rendered d2, it will not move it at 2s when it has to render d1. Instead it will render d1 above it.
  • For the same reason, at 6s even though d2 is gone, d1 will remain floating in the air.
  • vsfilter caches a dialogue once it's rendered. So say you seek to 10s and then back to 6s, d1 will be rendered fresh but it will still be floating in mid-air.

An interesting outcome of the third point above is that you can make it give different results. If you close and reopen the video and seek directly to 6s, now vsfilter will render d1 at the bottom. Then if you seek back to 3s, now it will render d2 above d1. Then if you seek to 0s and play normally, at 1s it will render d2 in the air, since that's where it's cached it now.

I do understand that sorting by start time emulates the order vsfilter would've chosen if playing normally.

At any rate, not moving dialogues when the current set of visible subs changes is another thing libjass can't do, since it relies on the browser to position the sub divs.


Pausing and playing should not reorder the dialogues. They should still render in the same order as before pause. I'll investigate.

@Arnavion
Copy link
Owner

Arnavion commented Aug 3, 2015

Oh right, it reorders on pause and play for a similar reason to vsfilter's caching - libjass doesn't re-render subs that are already displayed. So in normal playback the 4-* are already displayed, so the 5-* are appended below the 4-*. However on pause/play, all subs at the current time are re-rendered in script order, so 5-* are put first and 4-* appended below them.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants