VideoHelp Forum

Try DVDFab and download streaming video, copy, convert or make Blu-rays,DVDs! Download free trial !
+ Reply to Thread
Results 1 to 16 of 16
Thread
  1. I want to add subtitles to a video, which has a strip with written text at the bottom (sorry for the clumsy phrasing – what is the specific name by the way ?).
    If I use Avisynth's TextSub(), the subtitles (created with SubtitleEdit in SRT format) appear with a pleasant style, but are positioned partially over that strip, which affects their readability. I found a way to change the position of the subtitles by creating a .srt.style file (based on the template found in this thread) and setting the “MarginV” field to a suitable value. It works, but then, the margin is the same for 1 line subtitles as for 2 lines subtitles, whereas by default the subtitles are vertically centered, so that the 1 line subtitles appear in the middle of the lines of 2 lines subtitles, if that's clear enough.
    I found this thread adressing a similar issue :
    https://forum.videohelp.com/threads/373652-Positioning-subtitle-in-video
    The main advice is to convert to ASS format and then edit the margin separately for 1 lines subtitles and 2 lines subtitles.
    Isn't there a more simple way of achieving what I want, which is, to keep the default style and default behaviour of SRT files as rendered by TextSub() and only shift them a few pixels lower ?
    Also, if I do have to convert to ASS format, what would be the settings which would mimic the default appearance with TextSub and SRT format ?

    Click image for larger version

Name:	GCarlin TextSub défaut 2L.png
Views:	49
Size:	339.5 KB
ID:	49857
    Click image for larger version

Name:	GCarlin TextSub défaut 1L.png
Views:	36
Size:	337.4 KB
ID:	49858
    Click image for larger version

Name:	GCarlin TextSub style 2L.png
Views:	37
Size:	349.5 KB
ID:	49859
    Click image for larger version

Name:	GCarlin TextSub style 1L.png
Views:	41
Size:	349.2 KB
ID:	49860
    Quote Quote  
  2. Solution 1:
    Use 2 srt files. One for dual lines and one for single lines. Then you can make separate .style files for each of them. (Not sure if/why this would be easier for you?)
    Or use some AviSynth "magic" to move one up (e.g. use MaskSub() and crop the top by the amount of wanted margin, then overlay).

    Solution 2 (preferred by me):
    Use ASS file for all lines. Make 2 different styles. In Aegisub you can "Subtitle"->"Select lines" with "Text" "\N" (for line break). Then just set them to the Style you created for dual lines.


    Originally Posted by abolibibelot View Post
    what would be the settings which would mimic the default appearance with TextSub and SRT format ?
    Try:
    Code:
    [Script Info]
    Title: Style equivalent to SRT rendering by TextSub()
    ScriptType: v4.00+
    WrapStyle: 0
    ScaledBorderAndShadow: no
    YCbCr Matrix: none
    PlayResX: 1280
    PlayResY: 720
    
    [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,Arial,45,&H00FFFFFF,&H000000FF,&H00000000,&HC80000000,1,0,0,0,100,100,0,0,1,2,3,2,10,10,50,1
    Quote Quote  
  3. Alright then... but it seems quite convoluted for something that could be much more simple, considering what Avisynth can do in other areas. Isn't it possible to simply shift the subtitles overlay by a given amount of pixel with an extra Avisynth command ?
    But then why are the 1 line subtitles centered by default ? Why isn't it possible to preserve that behaviour when adding a .style file ?
    Actually I'm not so sure about that, looking back at the file I encoded yesterday, in fact the 1 line subtitles appear to be at the same height as the second line of 2 lines subtitles, it's just less conspicuous because they're not right at the edge of the frame... And in VLC Media Player the default behavious seems to be the same. (But in Subtitle Edit's interface the 1 line subtitles appear to be aligned with the first line of the 2 lines subtitles, perhaps that's what confused me.)
    What is the standard way of displaying 1 line / 2 lines subtitles on that particular aspect ?
    I found this quite thorough document on the general subject of standards in subtitling : https://translationjournal.net/journal/04stndrd.htm
    I haven't read it completely but it doesn't seem to mention that specific question (and since it's entitled “a proposal” I'm not sure if it reflects professional trends or merely the author's POV.)
    Quote Quote  
  4. Move the subs higher, not lower.

    Or cover that text entirely with them by making the subs within a solid black rectangle.
    Quote Quote  
  5. @ manono
    Move the subs higher, not lower.
    How ? And why ?

    Or cover that text entirely with them by making the subs within a solid black rectangle.
    I tried with the “3” value for the “BorderStyle” field, but don't like the effect. (Found the description of each field here in the aforementioned thread.)
    Is there another possibility, with an Avisynth command ? (I don't think that it would work well with this video, but it's good to know.)


    @ sneaker
    The “Styles Manager” interface in Aegisub is quite confusing, but I could get the desired result.
    The first solution would have been more “simple” in the sense that the SRT format is more simple, and that it would have revolved around methods I already knew, but more complicated to implement, while the second proved to be more straightforward (and more versatile).

    Click image for larger version

Name:	GCarlin C-Span extrait 10m39s-25m06s + ST Fr [ASS].mp4 - 00_07_55 -2019-08-19-22h08m47s198.png
Views:	12
Size:	333.8 KB
ID:	49863
    Click image for larger version

Name:	GCarlin C-Span extrait 10m39s-25m06s + ST Fr [ASS].mp4 - 00_07_57 -2019-08-19-22h08m14s532.png
Views:	15
Size:	338.6 KB
ID:	49864

    By the way, what is the specific name of that kind of strip of text at the bottom of a video or broadcast ?
    Quote Quote  
  6. video captions

    maybe the simplest solution is to make subs appear top center instead of bottom..


    aegisub has a move text function for. ass but that would be too complicated for you..
    Last edited by teodz1984; 19th Aug 2019 at 21:09.
    Quote Quote  
  7. Originally Posted by abolibibelot View Post
    @ manono
    Move the subs higher, not lower.
    How ? And why ?
    Why? So you don't sometimes get that extra space between the subs and that already-existing text. That's what you're complaining about, isn't it? Or move them all the way to the top, as teodz1984 suggest. Not subtitles but top titles.

    How? The same way you moved them lower, move them above the fixed text or all the way up near the top.
    Is there another possibility, with an Avisynth command ? (I don't think that it would work well with this video, but it's good to know.)
    Unless you're using the AviSynth Subtitle filter (you're not), there's no AviSynth command. The styles are set in the subtitle. And it's easier in an SSA or ASS file than an SRT.

    Did you understand what I was suggesting with the black rectangle? It may not be what you like, but it'll solve the problem of the text interfering with the subtitles. Something like this:
    Image Attached Thumbnails Click image for larger version

Name:	SubsBlackBox.jpg
Views:	130
Size:	61.6 KB
ID:	49865  

    Quote Quote  
  8. @ manono
    Why? So you don't sometimes get that extra space between the subs and that already-existing text. That's what you're complaining about, isn't it? Or move them all the way to the top, as teodz1984 suggest. Not subtitles but top titles.

    How? The same way you moved them lower, move them above the fixed text or all the way up near the top.
    I misunderstood that part, I thought that you implied that there was indeed a trick to move the subtitles higher, but not to move them lower. While you were actually advising to move them higher.
    What I managed to do (screenshots above in post #5) is satisfactory to me. I was disturbed by the fact that single lines were placed right at the bottom edge of the frame. That way it flows better. Top titles would be weird, it's extremely rare and seems counter-intuitive. Placing subtitles above that banner would be problematic as well, as the bottom of the frame would be empty while an area located in the second quarter from the bottom would be cluttered (and it would often cover the face of the speaker, as he moves a lot during his speech).
    The black rectangle solution : yes that's what I understood, and that's what I got when testing “BorderStyle” = “3” in the “.srt.style” file. I was asking if there was another method to get something similar, with an Avisynth command perhaps. In this case it would work better if the black rectangle occupied the full width of the frame.

    Unless you're using the AviSynth Subtitle filter (you're not), there's no AviSynth command. The styles are set in the subtitle. And it's easier in an SSA or ASS file than an SRT.
    For things like font and size it totally makes sense, but allowing a free placement of the subtitles overlay would seem trivial.

    What movie is this by the way ?


    @ teodz1984
    aegisub has a move text function for. ass but that would be too complicated for you..
    What do you mean by that ? O_o
    Quote Quote  
  9. Originally Posted by abolibibelot View Post
    In this case it would work better if the black rectangle occupied the full width of the frame.
    Using AviSynth it's easy enough to create a black rectangle to cover that text permanently and so the subtitles would be displayed within it. I don't know how to create a black rectangle that "occupied the full width of the frame" only when the subs are displayed. Perhaps someone better versed in AviSynth or subtitle creation can do it.

    The film? A 1958 Indian film called Parvarish I happen to be working on now. I had finished editing the subs and was working with the video so I used a frame from the film to show a line of subs within the black rectangle.

    https://www.imdb.com/title/tt0052051
    Quote Quote  
  10. I'm currently banging my head at the wall because I didn't see the easiest solution.

    Solution 3:
    Set ASS subtitles to be top center aligned. Then make marginV so huge they are at the bottom.
    Quote Quote  
  11. Originally Posted by manono View Post
    Originally Posted by abolibibelot View Post
    In this case it would work better if the black rectangle occupied the full width of the frame.
    Using AviSynth it's easy enough to create a black rectangle to cover that text permanently and so the subtitles would be displayed within it. I don't know how to create a black rectangle that "occupied the full width of the frame" only when the subs are displayed.
    I wrote a small guide for that once:
    https://forum.videohelp.com/threads/389973-How-can-I-create-this-translucent-rectangul...le#post2527186
    Quote Quote  
  12. Click image for larger version

Name:	FFate Apocrypha E21 Antares Snipe.mkv_20190820_172511.417.jpg
Views:	16
Size:	45.1 KB
ID:	49866
    Sample ASS Script


    [Script Info]
    ; Script generated by Aegisub 3.2.2
    ; http://www.aegisub.org/
    Title: Default Aegisub file
    ScriptType: v4.00+
    WrapStyle: 0
    ScaledBorderAndShadow: yes
    YCbCr Matrix: TV.709
    PlayResX: 1280
    PlayResY: 720


    [Aegisub Project Garbage]
    Last Style Storage: Default
    Video AR Mode: 4
    Video AR Value: 1.777778
    Video Zoom Percent: 0.500000
    Scroll Position: 41
    Active Line: 49
    Video Position: 6296
    [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,Tox Typewriter,55,&H0012EDF0,&HC0000000,&H00000000,&HA 8000000,0,0,0,0,95,100,0,0,1,6,1,2,10,10,10,1
    Style: Default-Italic,Tox Typewriter,55,&H00E8D577,&HC0000000,&H00000000,&HA 8000000,-1,-1,0,0,95,100,0,0,1,6,1,2,10,10,10,1

    [Events]
    Dialogue: 10,0:01:31.98,0:01:34.90,Default,,0,0,0,,Thank you, Teacher.
    Dialogue: 10,0:03:14.17,0:03:15.87,Default,,0,0,0,,{\pos(640,637)}Let's go!

    If you are willing to invest studying the AEGISUB as ASS subtitling, it is light years ahead of SRT subs
    For more on ASS tags
    http://docs.aegisub.org/3.2/ASS_Tags/
    Last edited by teodz1984; 20th Aug 2019 at 07:43.
    Quote Quote  
  13. IN Japanese Anime, TOPSUbs are common esp. on ANIME Opening and Endings...With English translation on top and Romanji or Kanji on Bottom...
    And also if the the bottom half is heavy with detail that might be occluded by text subs..

    Click image for larger version

Name:	SEISHUN BUTA YARO_E01-My Senpai is a Bunny Girl.mkv_20190820_184834.647.jpg
Views:	16
Size:	231.5 KB
ID:	49867


    ASS formatting allow you to put almost any place on the screen.. e.g. replace foreign text on signs, books. etc or thought bubbles ..
    It can be formatted horizontally vertically or curved ..
    You can even make lyric syllables recolor as they are sung like animation like karaoke in real time...
    It just takes time to learn how to code it

    e.g.[Script Info]
    ; Script generated by Aegisub 3.2.0
    ; 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: Default,Cabin,77,&H00FFFFFF,&H000019FF,&H004C2C1B, &HDC000000,-1,0,0,0,97,100,0.9,0,1,3.9,1.8,2,240,240,63,1
    Style: Alternative,Cabin,77,&H00FFFFFF,&H000019FF,&H00314 835,&HDC000000,-1,0,0,0,97,100,0.9,0,1,3.9,1.8,2,240,240,63,1
    Style: OP-rom,Timeless,62,&H00BD9A0F,&H008F2D12,&H00FFFFFF,& H00000000,-1,0,0,0,100,100,0,0,1,2.7,0,8,10,10,25,1
    Style: OP-eng,Timeless,62,&H00AD7800,&H008F2D12,&H00FFFFFF,& H00000000,-1,0,0,0,100,100,0,0,1,2.7,0,2,10,10,25,1


    [Events]
    Format: Layer, Start, End, Style, Name, MarginL, MarginR, MarginV, Effect, Text
    Dialogue: 2,0:01:35.03,0:01:38.10,OP-rom,,0,0,0,fx,{\fad(100,0)\pos(1181,25)\blur1}{\c& H20FFFFFF&}shi
    Dialogue: 3,0:01:35.03,0:01:38.10,OP-rom,,0,0,0,fx,{\fad(100,0)\bord0\c&H008F2D12&\pos( 1181,25)}shi
    Dialogue: 2,0:01:35.03,0:01:38.33,OP-rom,,0,0,0,fx,{\fad(100,0)\pos(1237,25)\blur1}{\c& H20FFFFFF&}ta
    Dialogue: 3,0:01:35.03,0:01:38.33,OP-rom,,0,0,0,fx,{\fad(100,0)\bord0\c&H008F2D12&\pos( 1237,25)}ta
    Dialogue: 2,0:01:35.03,0:01:38.67,OP-rom,,0,0,0,fx,{\fad(100,0)\pos(1322,25)\blur1}{\c& H20FFFFFF&}you
    Dialogue: 3,0:01:35.03,0:01:38.67,OP-rom,,0,0,0,fx,{\fad(100,0)\bord0\c&H008F2D12&\pos( 1322,25)}you
    Dialogue: 2,0:01:35.03,0:01:39.02,OP-rom,,0,0,0,fx,{\fad(100,0)\pos(1403,25)\blur1}{\c& H20FFFFFF&}ni
    Dialogue: 3,0:01:35.03,0:01:39.02,OP-rom,,0,0,0,fx,{\fad(100,0)\bord0\c&H008F2D12&\pos( 1403,25)}ni
    Dialogue: 3,0:01:35.03,0:01:39.53,OP-eng,,0,0,0,fx,{\blur1\fad(100,150)\pos(960,1055)}I silently take it all in, including the sound of the waves



    Note: This move was done to temporary shift the location of the subs that would conflict with a text message put by the TV station
    Last edited by teodz1984; 20th Aug 2019 at 07:44.
    Quote Quote  
  14. @ sneaker
    I'm currently banging my head at the wall because I didn't see the easiest solution.
    Solution 3:
    Set ASS subtitles to be top center aligned. Then make marginV so huge they are at the bottom.
    So in this case the single line subtitles would be aligned with the first line of the 2 lines subtitles, right ?
    What I did (screenshots above, or the end result here) with two style templates in Aegisub, as per you “solution 2” suggestion, was to position the single line subtitles approximately centered relative to the 2 lines subtitles, I find is more “balanced” that way for lack of a better word. I set MarginV to 25 for the “1L” style template and 8 for the “2L” style template.
    But that workaround would work with SRT too, wouldn't it ? (I'll do some more tests later on, right now I switched to a completely different task, and I have such a hard time finishing things these days that it would be a bad idea to get distracted...)


    @ teodz1984
    IN Japanese Anime, TOPSUbs are common esp. on ANIME Opening and Endings...With English translation on top and Romanji or Kanji on Bottom...
    And also if the the bottom half is heavy with detail that might be occluded by text subs..
    Yes, I've seen that on Saint Seiya and Hokuto no Ken french fan-subs. (That's about the extent of my culture in japanese animation ! I also loved Dragon Ball as a kid, but so far I haven't mustered the courage to re-watch the 500+ episodes in non-dubbed subtitled version...) The names of the attacks also receive the double-subtitling treatment, with the “karaoke” effect you described.
    But for a relatively “formal” speech it would be odd and distracting.


    Stars are swinging in my lap
    I silently take it all in, including the sound of the waves

    It's funny how those two quotes seem to reply to each other !... Could be the start of a sort of polyphonic poem...
    Has anyone ever done this, cutting quotes from various movies to create a visual poem, or to tell a whole new story ?
    Quote Quote  
  15. Originally Posted by abolibibelot View Post
    @ sneaker
    I'm currently banging my head at the wall because I didn't see the easiest solution.
    Solution 3:
    Set ASS subtitles to be top center aligned. Then make marginV so huge they are at the bottom.
    So in this case the single line subtitles would be aligned with the first line of the 2 lines subtitles, right ?
    What I did (screenshots above, or the end result here) with two style templates in Aegisub, as per you “solution 2” suggestion, was to position the single line subtitles approximately centered relative to the 2 lines subtitles, I find is more “balanced” that way for lack of a better word. I set MarginV to 25 for the “1L” style template and 8 for the “2L” style template.
    Ah, ok. I guess "Solution 3" was too easy after all.
    Quote Quote  
  16. If you don't like the space between lines when using a black box background you can render the subs to a superwhite video, build a mask of everything that's not superwhite, expand the mask, then use the mask to overlay a black box where the subs are going to appear on the video, then render the subs onto the video. In short, grow the black boxes until they fill the space between them.

    Code:
    LSmashVideoSource("filename.mp4") 
    
    Black = BlankClip(last, color=$000000)
    White = BlankClip(last, color=$FFFFFF).ColorYUV(off_y=20) # force white to superwhite (Y=235 to Y=255)
    
    bmask = TextSub(white, "filename.ssa", 0, 0).mt_binarize(254, true).mt_expand().mt_expand().mt_expand().mt_expand(chroma="-128")
    Overlay(last, black, mask=bmask) # expanded black box 
    
    TextSub("filename.ssa") # write subs
    Use as many mt_expand() calls as necessary to fill the space between the two (or more) lines of text. All subs will get a slightly larger black box, of course. If you want you can mitigate that by calling mt_inpand() a few times to shrink the boxes down (once the boxes have merged they won't split again).

    I don't have any SSA subs to test so I just used some SRT subs. They don't have a black box background but you can see the black outlines around the characters expanded and touched. Normal subs on top, expanded on bottom:

    Image
    [Attachment 49870 - Click to enlarge]


    Also, I highly recommend you not put subs too near the bottom of the frame. Many people will have TV's that overscan and the subs will not be visible, or only partially visible. That's why the title scroll is so high in the frame.
    Last edited by jagabo; 20th Aug 2019 at 23:20.
    Quote Quote  



Similar Threads