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

Support for Rollup Captions #174

Open
damascene opened this issue Dec 18, 2022 · 3 comments
Open

Support for Rollup Captions #174

damascene opened this issue Dec 18, 2022 · 3 comments

Comments

@damascene
Copy link

damascene commented Dec 18, 2022

I would like to ask if possible to support Rollup captions as used in Youtube. It seems like the subtitle is rolling up instead of flashing on screen.

It works best with machine generated text where there could be not very accurate separation between sentences so the software will show the previous subtitle on one line and the current one in another line and people can link them in their brain.

image

Here is an example on how the subtitle file is generated by Youtube, notice the line reputation :

00:00 --> 00:03 
This is the first line

00:03 --> 00:10 
This is the first line
This is what happens when another line is added

00:10
This is what happens when another line is added
If a third one is added, the first one disappears and the second one shoots up

More info about roll-up captions at this link:
https://www.w3.org/community/texttracks/wiki/RollupCaptions

One person wants to convert the rolling subtitle to normal one, but maybe if good support for rolling subtitle is implemented it could be used:

yt-dlp/yt-dlp#1734

I wonder if it's possible to get support for rolling subtitle in the software. I suggest to change the color of the previous line to a different color than the current line to give better feeling as it could be confusing sometimes.

@arch1t3cht
Copy link
Collaborator

If you are looking to create such an effect from existing subtitles, you can do this with karaoke templates. There is a templater shipped with Aegisub. Or you can write an automation script yourself. The details depend on how exactly you want the effect to look.

@damascene
Copy link
Author

@arch1t3cht thank you for responding. I've tried one tutorial on Karaoke. It needs someone with Lua scripting skills to create I guess. I'm putting a little $25 bounty tip paid in crypto for someone to create such a script.

Would be nice to have it implemented in software though. Apparently rollup captions are useful for many use cases and even subtitle coming from youtube could be feed to up converted to standard popup subtitles or vice versa

@arch1t3cht
Copy link
Collaborator

Miss me with crypto, but here's a template to generate something resembling youtube captions.

[Script Info]
; Script generated by Aegisub 9533-feature-e156ece09 [DEBUG VERSION]
; http://www.aegisub.org/
Title: Default Aegisub file
ScriptType: v4.00+
WrapStyle: 0
ScaledBorderAndShadow: yes
YCbCr Matrix: TV.709
PlayResX: 1920
PlayResY: 1080

[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: Rollup,Noto Sans,60,&H00FFFFFF,&H000000FF,&H00000000,&H00000000,0,0,0,0,100,100,0,0,1,2,0,2,10,10,20,1

[Events]
Format: Layer, Start, End, Style, Name, MarginL, MarginR, MarginV, Effect, Text
Comment: 0,0:00:00.00,0:00:03.00,Rollup,,0,0,0,code once,function d(...) end -- dummy function for comments or return value dumping
Comment: 0,0:00:00.00,0:00:03.00,Rollup,,0,0,0,code once,padding = 10; join_threshold = 1000; move_time = 300; fade = 150;
Comment: 0,0:00:00.00,0:00:03.00,Rollup,,0,0,0,code once,for i=1,3 do tenv["part" .. i] = function() return loopctx.state.part == i end; end
Comment: 0,0:00:00.00,0:00:03.00,Rollup,,0,0,0,code line,if maxwidth == nil then maxwidth = 0; local l = orgline; while l ~= nil do maxwidth = math.max(maxwidth, l.width); l = l.next; end end
Comment: 0,0:00:00.00,0:00:03.00,Rollup,,0,0,0,code line,hasprev = tenv.hasnext or false; hasnext = orgline.next ~= nil and orgline.next.start_time - orgline.end_time < join_threshold; hasnextnext = hasnext and orgline.next.next ~= nil and orgline.next.next.start_time - orgline.next.end_time < join_threshold;
Comment: 0,0:00:00.00,0:00:03.00,Rollup,,0,0,0,code syl,sx = orgline.center - maxwidth / 2 + syl.left; sy = orgline.top;
Comment: 0,0:00:00.00,0:00:03.00,Rollup,background,0,0,0,template syl notext loop part 3,{\1a&H80&\c&H000000&}
Comment: 1,0:00:00.00,0:00:03.00,Rollup,,0,0,0,template syl loop part 3,
Comment: 0,0:00:00.00,0:00:03.00,Rollup,,0,0,0,mixin syl,!maxloop("part", hasnextnext and 3 or (hasnext and 2 or 1))!
Comment: 0,0:00:00.00,0:00:03.00,Rollup,,0,0,0,mixin syl if part1,!retime("abs", orgline.start_time, hasnext and orgline.next.start_time or (orgline.end_time))!
Comment: 0,0:00:00.00,0:00:03.00,Rollup,,0,0,0,mixin syl if part2,!retime("abs", orgline.next.start_time, hasnextnext and orgline.next.next.start_time or orgline.next.end_time)!
Comment: 0,0:00:00.00,0:00:03.00,Rollup,,0,0,0,mixin syl if part3,!retime("abs", orgline.next.next.start_time, orgline.next.next.start_time + move_time)!
Comment: 0,0:00:00.00,0:00:03.00,Rollup,,0,0,0,mixin syl,{\an7!\bord0\shad0}
Comment: 0,0:00:00.00,0:00:03.00,Rollup,,0,0,0,mixin syl if part1,!d(hasprev and mskip())!{\pos(!sx!, !sy!)}
Comment: 0,0:00:00.00,0:00:03.00,Rollup,,0,0,0,mixin syl if part1,!d(hasprev or mskip())!{\move(!sx!, !sy + orgline.height!, !sx!, !sy!, 0, !move_time!)}
Comment: 0,0:00:00.00,0:00:03.00,Rollup,,0,0,0,mixin syl if part1,{\fad(!hasprev and 0 or fade!,!hasnext and 0 or fade!)}
Comment: 0,0:00:00.00,0:00:03.00,Rollup,,0,0,0,mixin syl if part2,!d(hasnextnext and mskip())!{\fad(0, !fade!)}
Comment: 0,0:00:00.00,0:00:03.00,Rollup,,0,0,0,mixin syl if part2,{\move(!sx!, !sy!, !sx!, !sy - orgline.height!, 0, !move_time!)}
Comment: 0,0:00:00.00,0:00:03.00,Rollup,,0,0,0,mixin syl if part3,{\move(!sx!, !sy - orgline.height!, !sx!, !sy - 2 * orgline.height!, 0, !move_time!)}
Comment: 0,0:00:00.00,0:00:03.00,Rollup,,0,0,0,mixin syl,{\clip(!sx - padding!, !sy - orgline.height!, !sx + syl.width + padding!, !sy + orgline.height!)}
Comment: 0,0:00:00.00,0:00:03.00,Rollup,,0,0,0,mixin syl t_actor background,{\p1}m !-padding! 0 l !syl.width + padding! 0 !syl.width + padding! !orgline.height! !-padding! !orgline.height!
Comment: 0,0:00:00.00,0:00:03.00,Rollup,,0,0,0,,
Comment: 0,0:00:00.00,0:00:03.00,Rollup,,0,0,0,kara,This is the first line
Comment: 0,0:00:03.00,0:00:06.00,Rollup,,0,0,0,kara,This is what happens when another line is added
Comment: 0,0:00:06.50,0:00:09.00,Rollup,,0,0,0,kara,If a third one is added, the first one disappears and the second one shoots up
Comment: 0,0:00:11.00,0:00:15.00,Rollup,,0,0,0,kara,Some more text that comes in later

Time some set of lines, give them the style, comment them and give them the kara effect, and run the template using The0x's templater.

rollup_0.000-15.000.mp4

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

2 participants