Is it possible to change the size of subtitle text from an SRT file in FFmpeg

15,585

Solution 1

It is possible to set font size in side of srt file, you can do it just like this

<font size="30px">Font size 30px</font>

Solution 2

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.

Share:
15,585

Related videos on Youtube

Eftekhari
Author by

Eftekhari

Updated on September 18, 2022

Comments

  • Eftekhari
    Eftekhari almost 2 years

    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.
    
    • Giacomo1968
      Giacomo1968 over 5 years
      It’s my understanding that unless the text is burned into the video, the subtitle text is controlled by the player that plays back the video. So not clear if this is even possible.
    • Gyan
      Gyan over 5 years
      SRT files don't signal font size; it is set by the player.
    • Eftekhari
      Eftekhari over 5 years
      @JakeGould Sorry, I asked the question in a wrong way. I've edited the question. Thanks for the reply.
    • Eftekhari
      Eftekhari over 5 years
      @Gyan Sorry, I asked the question in a wrong way. I've edited the question. Thanks for the reply.
    • Seth
      Seth over 5 years
      Figure out what's the max length acceptable to you and edit the SRT to have no lines longer than that.
    • Gyan
      Gyan over 5 years
      If you use a subtitle editor like Aegisub, you should be able to get it to wrap lines longer than a specified limit.
  • Chef Pharaoh
    Chef Pharaoh over 4 years
    Great answer. Can it be changed globally also? I want to avoid changing all the phrases in the file manually...