I've used AviSynth+ a few times. I want to add credits at the end of a show on several lines and would rather avoid repeating the settings and tune the alignment for each line. The page below uses newline characters (\n) to introduce newlines in a subtitle in AviSynth:
https://compactvideo.wordpress.com/2011/03/26/how-to-create-titles-and-captions-using-avisynthCode:subtitle("First line\nNext line\nLast line", ...)
I tried this code on AviSynth+ and it fails.
What is the simplest way to include newlines in subtitles?
+ Reply to Thread
Results 1 to 4 of 4
Last edited by miguelmorin; 22nd Feb 2020 at 03:10. Reason: fixed hyperlink
You have to specify lsp (line spacing parameter) for \n line breaks
subtitle("First line\nNext line\nLast line", lsp=10)
int lsp =
Line Spacing Parameter; enables multi-line text (where "\n" enters a line break). If lsp is less than zero, inter-line spacing is decreased; if greater, the spacing is increased, relative to Windows' default spacing. By default, multi-line text disabled.
In the unlikely event that you want to output the characters "\n" literally in a multi-line text, you can do this by using "\\n".
On the AviSynth Subtitle page it says to do it like so:
Print text on multiple lines with no halo border
"Some text on line 1\\nMore text on line 1\n" + \
"Some text on line 2", \
It results in:
Some text on line 1\nMore text on line 1
Some text on line 2
Me, I'd just create a real SSA subtitle file and add it to the script using the TextSub filter (part of the VSFilter).
My bad, I missed the argument lsp at the end of the command in the page that I mentioned, and also the example on the wiki. Thanks both!
On this occasion I prefer to keep the credits as subtitles since they are at most 1 minute in a one hour show with no audio. I'll definitely use SubStation Alpha in the future for creating subtitles related to the audio.