VideoHelp Forum
+ Reply to Thread
Results 1 to 4 of 4
Thread
  1. 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:

    Code:
    subtitle("First line\nNext line\nLast line", ...)
    https://compactvideo.wordpress.com/2011/03/26/how-to-create-titles-and-captions-using-avisynth

    I tried this code on AviSynth+ and it fails.

    What is the simplest way to include newlines in subtitles?
    Last edited by miguelmorin; 22nd Feb 2020 at 03:10. Reason: fixed hyperlink
    Quote Quote  
  2. You have to specify lsp (line spacing parameter) for \n line breaks

    Code:
    subtitle("First line\nNext line\nLast line", lsp=10)

    http://avisynth.nl/index.php/Subtitle

    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".
    Quote Quote  
  3. On the AviSynth Subtitle page it says to do it like so:

    Print text on multiple lines with no halo border

    BlankClip()
    Subtitle( \
    "Some text on line 1\\nMore text on line 1\n" + \
    "Some text on line 2", \
    lsp=10, halo_color=$ff000000)

    It results in:

    Some text on line 1\nMore text on line 1
    Some text on line 2
    http://avisynth.nl/index.php/Subtitle

    Me, I'd just create a real SSA subtitle file and add it to the script using the TextSub filter (part of the VSFilter).
    Quote Quote  
  4. 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.
    Quote Quote  



Similar Threads

Visit our sponsor! Try DVDFab and backup Blu-rays!