4

Is it possible to change the size of the subtitle text (SRT) automatically? If the text is too long the font size becomes smaller to be able to show the whole text on the screen.

In my case, the SRT file contains only one text and I want to burn it into the intro video as a title or information given about the video. Sometimes the title is a long text that goes out of the video's screen size. I wonder if there are any approaches to show a long text within the video's screen size automatically?

This is an example of such SRT file's content that I want to burn on the intro video.

1  
00:00:00,000 --> 00:00:03,000  
TITLE  
Information about the video goes here  
and sometimes it is too long and goes out  
of the video's screen size while using 
a big font sizes like 40 or 50.
4
  • 3
    SRT files don't signal font size; it is set by the player.
    – Gyan
    Commented Feb 6, 2019 at 5:51
  • @Gyan Sorry, I asked the question in a wrong way. I've edited the question. Thanks for the reply.
    – Eftekhari
    Commented Feb 6, 2019 at 8:12
  • Figure out what's the max length acceptable to you and edit the SRT to have no lines longer than that.
    – Seth
    Commented Feb 6, 2019 at 9:51
  • If you use a subtitle editor like Aegisub, you should be able to get it to wrap lines longer than a specified limit.
    – Gyan
    Commented Feb 6, 2019 at 11:24

5 Answers 5

6

It is possible to set font size inside of srt file and you can do it just like this:

<font size="30px">Font size 30px</font>
1
  • Great answer. Can it be changed globally also? I want to avoid changing all the phrases in the file manually... Commented Jan 5, 2020 at 20:55
1

No, it's not possible. SRT files carry no styling information related to fond size; it's up to the player to decide the size when displaying the subtitles.

You could (or should) make sure that the subtitles do not exceed a certain length by using a subtitle editor. This also improves accessibility for your subtitles.

Another alternative would be to use subtitles that support styling like SSA/ASS subtitles. You need proper container support though if you want to play them as soft subtitles (e.g. MKV), and your player also needs to support it (see e.g. supported subtitle formats in VLC). You could also burn them into the video if you need compatibility with other formats.

Aegisub is a subtitle editor with lots of features.

1

Well, technically .srt is just a .txt file formatted as .srt (pretty much like HTML files). An interestingly enough they happen to support HTML tags and therefore CSS styles.

However just like HTML they don't work the same on different video players. It works on KMPlayer. VLC actually didn't display the subtitle. And on PotPlayer it could work if you go to subtitle settings and under "Ignore HTML tags" uncheck 'Absolute Sizes' (Those like px, cm, inch, ...).

However, this is not really reliable and if you want to make something colorful and have text move all around the screen you will be better off using .ass or .ssa file format. Much more versatile.

0

I'm late to the party on this question, but it's worth pointing out that the tag in SRT files is supported by FFMpeg, so you can set the size, color, and face attributes. However, something like <font size="40px">foo</font> will not yield 40px text. FFMpeg is doing some sort of proportional rendering. So, size="40" means different things on different sizes of video.

0

I try to use this style, and it works for me to force the player to display the font size I want:

<font size="20px">"the subtitle text you want to size it"</font>

It is for .srt file

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .