How to add subtitles to a video using FFmpeg (5 different styles) (2023)

contents

    Capture the audience's attention with an increasingly shorter attention span,Adding subtitles to videos has become the norm🇧🇷 Popular video streaming platforms like Youtube, Netflix and Crunchyroll add subtitles to their videos and you should too.

    It not only keeps the attention of the audience, but also breaks the language barrier. International fans can enjoy phenomenal TV shows like Money Heist, Squid Game, and other Japanese anime shows with the help of translated subtitles.

    These video streaming platforms use different styles for their subtitles and they are quite different. Although most of them use fluent subtitles, you canUse FFmpeg to embed physical subtitleswith outfits like hers in her videos.

    In this article, I'll show you how to create different styles for your subtitles.

    The default caption style

    A default subtitle style is applied to each subtitle added with FFmpeg. If the subtitle is in SRT format, you can convert it to an ASS subtitle file with the following command:

    ffmpeg -i leyenda.srt leyenda.ass

    In themLeyenda.esfile, you can read the default font name, font size, color, and other style properties from the style definition list.

    How to add subtitles to a video using FFmpeg (5 different styles) (1)

    The default caption style uses Arial font and color white with a black border for your text.

    How to add subtitles to a video using FFmpeg (5 different styles) (2)

    How to change the subtitle style

    You can define the style in the subtitle file yourself or use theforce_styleFilter option "Subtitles" on the command line. The detail is in the "caption design"Section fromHow to add subtitles to a video file using FFmpeg.

    In the next section of this article, I'll show you some subheading styles that you can use. For each of the subtitle styles there are:

    • A list of style definitions that you can change in an ASS subtitle file (option 1)
    • An FFmpeg command that sets the subtitle style when adding a subtitle to a video file (option 2)

    examples

    For option 1, you'll see some key-value pairs like this below:

    Format: Font Name, Outline Color, Border Style: Roboto, &H40000000, 3
    (Video) Video subtitles using FFMPEG

    These are some ofProperties you can set for a heading style🇧🇷 In your ASS subtitle file, change the values ​​in the second line of the key-value pairs and add the subtitle to your video.

    For option 2, you will see an FFmpeg command with the subtitle styles specified in theforce_stylePossibility:

    ffmpeg -i input.mp4 -vf "subtitles=subtitle.srt:force_style='Fontname=Roboto,OutlineColour=&H40000000,BorderStyle=3'" output.mp4

    You can run the command directly in your command line/terminal after changing the input file and output file names.

    Any of these options above can be used to change the style of the subtitles. Next, let's see how styles are defined.

    Custom caption styles

    Style 1 - Youtube

    YouTube subtitles use a very easy to read subtitle style on any video, no matter the color. It is similar to the default soft caption style added with FFmpeg, which uses white color for its text surrounded by a semi-transparent black box.

    How to add subtitles to a video using FFmpeg (5 different styles) (3)

    font name: robot
    Font Color: Weiss
    background colorA: white
    background opacity: 75% (25% transparency)

    Style definition (.ass file):

    Format: Font Name, Outline Color, Border Style: Roboto, &H40000000, 3

    Domain:

    ffmpeg -i input.mp4 -vf "subtitles=subtitle.srt:force_style='Fontname=Roboto,OutlineColour=&H40000000,BorderStyle=3'" output.mp4

    The default value foredge styleit is1, which adds an outline and a drop shadow to the text. It accepts only two possible values,1o3🇧🇷 Whenedge styleis set to3, an opaque box is added that becomes the background for the title text.

    outline colordefines the color of the field with hexadecimal code, but in the format &HBBGGRR. It is in the reverse order of a standard HTML hexadecimal code that follows the string "RRGGBB".

    The hexadecimal code used in an ASS file also does not start with "#", but instead uses the "&H" prefix. if you use#2596bein HTML, you need to change it to&Hbe9625.

    You can also add transparency to the color by adding thecorresponding hexadecimal valuebefore "BBGGRR".

    In this legend style, the background color is black (&H000000) while its transparency is 25% (40🇧🇷 Hence the full hexadecimal code&H40000000.

    (Video) Change video subtitle background using #FFMPEG CLI

    How to add subtitles to a video using FFmpeg (5 different styles) (4)

    Still 2 - Netflix

    Netflix uses capital letters and the color white for the default subtitle text. A black shadow is added to the title to separate the text from the background. It's not as clear as YouTube subtitles, which have a black background behind the text, but it looks cleaner and is less distracting.

    How to add subtitles to a video using FFmpeg (5 different styles) (5)

    font name: Consoles
    Font Color: Weiss
    shadow color: Schwartz
    shadow opacity: 75%

    Style definitions (.ass file):

    Format: Font Name, Background Color, Spacing, Outline, Shadow Style: Consoles, &H80000000, 0.2, 0, 0.75

    Domain:

    ffmpeg -i input.mp4 -vf "subtitles=subtitle.srt:force_style='Fontname=Consolas,BackColour=&H80000000,Spacing=0.2,Outline=0,Shadow=0.75'" output.mp4

    background colorsets the text outline or shadow color, depending on which is usedcontoursets its width in pixels. Whencontouris set to 0, a drop shadow is added to the text, and&H80000000becomes the color of the shadow.

    The shadow depth can also be adjusted and the value ranges from 0 to 4. For this caption style, we used a shadow depth of 0.75 which appears soft but still allows the text to stand out.

    How to add subtitles to a video using FFmpeg (5 different styles) (6)

    Style 3 - Aesthetic (Vintage Yellow Legend)

    In addition to white, yellow is also often used for subtitles. Compared to white, a yellow subtitle is more noticeable and easier to read against different backgrounds.

    Athe yellow caption is not for everyonehow some people find it distracting compared to a blank legend that is more neutral. Still, some people prefer the yellow subtitle because it makes them feel nostalgic.

    It also gives an aesthetic and vintage touch when the font style is italicized.

    How to add subtitles to a video using FFmpeg (5 different styles) (7)

    font name: Ariel
    Fuente heart: Gelb
    Style: italics
    frame color: Schwartz

    Style definitions (.ass file):

    (Video) How to add subtitles to a video | Burn in subtitle video effect #ffmpeg #TheFFMPEGGuy

    Format: Primary Color, Italic, Spacing Style: &H03fcff, 1, 0.8

    Domain:

    ffmpeg -i input.mp4 -vf "subtitles=subtitle.srt:force_style='PrimaryColour=&H03fcff,Italic=1,Spacing=0.8'" output_aesthetic.mp4

    The font color can be adjusted byprimary colorproperty and surroundingsItalica 1 applies an italic style to the text.

    The default style without gaps makes bright yellow text look too compressed in a video. Increasing the spacing to 0.8 can make the legend more visually pleasing.

    How to add subtitles to a video using FFmpeg (5 different styles) (8)

    Estilo 4 – Anime/Crunchyroll

    This is one of the most common subtitle sources used in many anime shows. It is also the font used bycrispy rolls, a video streaming platform that offers more than 1,000 anime shows to more than 5 million paying subscribers around the world.

    Since this font is often used in subtitles for anime shows, an anime lover can easily recognize the font and associate it with the anime.

    How to add subtitles to a video using FFmpeg (5 different styles) (9)

    font name: Trebuchet MS
    Fuente heart: Weiss
    frame color: Schwartz

    Style definitions (.ass file):

    Format: Font Name Style: Trebuchet MS

    Domain:

    ffmpeg -i input.mp4 -vf "subtitles=subtitle.srt:force_style='Fontname=Trebuchet MS'" salida.mp4

    The only property that needs to be changed is the font name, while other properties can use the default value. Phrasefont namefor Trebuchet MS and you can add subtitles to your video.

    How to add subtitles to a video using FFmpeg (5 different styles) (10)

    To use: You can use any font installed on your operating system in an ASS file. If the font is not applied in the output video, you can download the TTF font file and place it in your current directory.

    (Video) Subtitles & FFMPEG: How To Caption Your Video The FFmpeg Way

    Style 5 - your own style

    In addition to the popular caption styles most people are familiar with, like the ones mentioned above, you can create your own caption style designed specifically for your audience!

    When adding subtitles to movies or videos longer than 30 minutes, black and white colors may still be the best. For other videos, you can experiment with different colors, especially if you're making a short video for a brand.

    If you have a brand kit, using brand colors in your video caption can help maintain brand consistency.

    You can use the following style definitions as a guide for changing the legend font, border, background, and shadow colors. Other properties likefont name,font size,bold, etc. are self-explanatory, you can also change them.

    Standard style with border

    How to add subtitles to a video using FFmpeg (5 different styles) (11)

    Style definitions (.ass file):

    Format: Primary Color, Outline Color, Border Style, Outline Style: "Font Color", "Border Color", 1, "Border Width 0-4"

    solid track record

    How to add subtitles to a video using FFmpeg (5 different styles) (12)

    Style definitions (.ass file):

    Formato: PrimaryColour, OutlineColour, BorderStyleStyle: "Font Color", "Background Color", 3

    cast shadow

    How to add subtitles to a video using FFmpeg (5 different styles) (13)

    Style definitions (.ass file):

    Format: Primary Color, Outline Color, Background Color, Border Style, Outline, Shadow Style: "Font Color", "Border Color", "Shadow Color", 1, "Border Width 0-4 ", "Shadow Depth 0-4"

    Automatically generate subtitles

    Besides FFmpeg, there are other tools you can use to add subtitles to video files. Some likeold banderaYou can even automatically generate captions for your videos and add them to videos with custom styles and other elements.

    (Video) FFmpeg | Adding Subtitle to a Movie

    If you're interested in trying it out, this article can help you get started:How to create videos with automatic captions in an API request.

    No matter what type of videos you are producing, adding subtitles to your videos definitely brings more benefits and you should use it to gain an edge over others.

    FAQs

    How can I add subtitles to a video easily? ›

    How to add subtitles to a video
    1. Upload a recording or movie. Add a video to the subtitler: from your computer, a camera roll on your smartphone, or from a cloud. ...
    2. Add and edit subtitles. Choose a suitable for you option to add captions: manually or with a subtitle file. ...
    3. Download the subtitled video. Everything is ready now!

    How do you combine subtitles with video? ›

    Online tool to hardcode your SRT subtitle file on your Video file, easily merge your SRT file and your Video in minutes.
    ...
    Add SRT to Video
    1. Upload your Video file. Select the Video which you want to burn your subtitle file.
    2. Upload the SRT file. ...
    3. Customization. ...
    4. Download the Video.

    Does MP4 support multiple subtitles? ›

    With MP4, you can burn ONLY 1 subtitle track into the video. You can not pass-through PGS into MP4 as this file format does not support it. With MKV, you can pass-through multiple PGS tracks. These are not burned into the video unless you choose to do so however you can only burn 1 subtitle track into the file.

    How do I add SRT subtitles to a video? ›

    How to Add SRT to MP4
    1. Select Video (MP4) File. Choose the video you want to add subtitles to. ...
    2. Add SRT file. Click 'Subtitles' > 'Upload Subtitle File', then select the SRT file you wish to add.
    3. Burn subtitles to video.

    Can you auto generate subtitles for a video? ›

    Automatic Subtitles Generator

    With VEED, you can automatically generate subtitles for your videos. Then, you can render them into the video permanently (hardcode subtitles), or if you prefer, download them as a separate subtitle file instead (SRT, VTT, TXT, etc.)

    What is the fastest way to combine subtitles and video? ›

    How to Add Subtitles to a Video
    1. Select a Video File. Choose which video file you want to add subtitles to. ...
    2. Manually type, auto transcribe, or upload subtitle file. Click 'Subtitles' in the sidebar menu and you can start to type your subtitles, 'Auto Transcribe', or upload a subtitle file (eg. ...
    3. Edit & Download.

    How do I combine multiple subtitles into one? ›

    Simple merge

    Using the simple mode, the merge file will simply be merged into the base file. The cues from both files are combined into one file. Cue style and cue timings are not changed. You can select the option to make the merge subtitle appear at the top of the screen.

    How do I merge subtitles to MP4? ›

    How to add SRT to MP4?
    1. Upload your MP4 file. Select the MP4 which you want to burn your subtitle file.
    2. Upload the SRT file. Or click on "autogenerate subtitles" with Happy Scribe.
    3. Customization. Customize your captions, change the color, font, and position of your subtitles.
    4. Download the MP4.

    How can I add subtitles to a movie permanently without converting? ›

    Here's how to add subtitles to a movie permanently with VLC.
    1. Open the Media menu and select Stream.
    2. Now add the subtitles files – tick Use a subtitle file box, click Browse, and select your SRT file.
    3. To indicate the folder for export, select File and click Add.
    4. Tick the Activate Transcoding box.
    11 Apr 2022

    How can I add subtitles to a video without any software? ›

    If you want to add subtitles to a video without downloading any software, you'll have to choose an online subtitle editor like Kapwing, which will allow you to add subtitles to video without having to download or install anything on your local device.

    What is an SRT file format? ›

    SRT, or SubRip File Format, is one of the most popular subtitle file formats for video content. These plain text files include the text of the subtitles in sequence, along with the start and end timecodes. However, an SRT file does not contain any video or audio content.

    Which app is best for adding subtitles to video? ›

    3 Best Subtitle Apps for iOS and Android
    1. PowerDirector - Best Overall Choice. Compatibility: Android (5.0 and up) and iOS (12.0 or later) ...
    2. MixCaptions: Video Captions - Best for Automatic Subtitles. Compatibility: Android (10 and up) and iOS (11.1 or later) ...
    3. Veme.ly: Video Subtitle: Best Basic Editing App. Compatibility:
    17 Feb 2022

    How long does it take to subtitle a 1 hour video? ›

    In professional captioning studios, captioners who do this every day generally average between five and ten minutes of work for every minute of video. A one-hour video is generally a full day's work.

    How long does it take to subtitle a 20 minute video? ›

    A trained transcriptionist will usually take around 4 to 5 hours to transcribe 1 hour of audio or video content. On the other hand, a first-timer to closed captioning could take anywhere from 20 to 100 hours to transcribe the same amount of content from scratch.

    Which video player is best for subtitles? ›

    10 Good Video Players Helping You Embed and Play Subtitles
    • VLC Player.
    • KM Player.
    • Zoom Player.
    • Kantaris.
    • GOM Media Player.
    • BS Player.
    • SMPlayer.
    • Banshee Media Player.

    Can you have two subtitles at once? ›

    You can only see one subtitle at a time. Especially for learning a language it is useful to see the original language and a translation. This way you hear, see, and translate the words of the movie.

    How do you synchronize subtitles? ›

    How to sync subtitles with video?
    1. Upload your subtitle file. Only SRT files are supported at the moment.
    2. Provide the offset in seconds. Write down the offset you want your subtitles to shift. ...
    3. Sync Subtitles. Click on "Sync Subtitles" to sync your subtitles with the provided offset.
    4. Download your new subtitle file.

    How do I splice subtitles? ›

    To add captions to your video, follow these steps:
    1. Open your project.
    2. Tap Text on the main tab bar > select Captions > OK, let's go!
    3. Once your captions are fully loaded, you have the option to edit each sentence manually. On the timeline, tap on the captions box: it becomes blue > tap Edit from the editing toolbar.

    How do I use H 265 in FFmpeg? ›

    In pass 1 and 2, use the -x265-params pass=1 and -x265-params pass=2 options, respectively. In pass 1, output to a null file descriptor, not an actual file. (This will generate a logfile that ffmpeg needs for the second pass.) In pass 1, you can leave audio out by specifying -an .

    How do I change the subtitle format? ›

    How to change subtitle/caption format?
    1. Upload the original subtitle file. Only SRT and VTT are supported at the moment.
    2. Select the target format. From the dropdown, select the format that you want to convert to.
    3. Convert. ...
    4. Download your subtitle file.

    What font style is used for subtitles? ›

    Futura is a great sans serif font that is clear, easy to read, and fits a variety of contexts. It's terrific for movie subtitles, work presentation captions, and social media content. We recommend it for users who need to fit long sentences and a lot of text on screen.

    What are the different types of subtitles? ›

    Different types of subtitles

    There are three main types of video subtitling services: open caption, closed caption and SDH (Subtitles for the Deaf and Hard of Hearing). The type you choose will depend on the purpose of your videos and your intended audience.

    Is it illegal to download subtitles? ›

    And indeed, that's exactly what the court ruled: that subtitles can only be created and distributed with permission from the rights holders. Doing so without permission is copyright infringement, and thus punishable with either jail time or a fine, depending on where you live.

    How do you inject subtitles to a movie? ›

    The easiest way to add subtitles to a movie is to give the subtitle file exactly the same name as the video file (excluding the format extension). Then keep both files in the same folder. When you open the movie in a media player, such as VLC, it automatically loads the subtitles along with the video.

    How do I convert MP4 to SRT? ›

    How do I convert my MP4 files to SRT?
    1. Upload your MPEG-4 Video File file(s) (*. ...
    2. Select the language spoken in your MP4 file. ...
    3. Sonix automatically extracts the audio from your MP4 file and converts it to the SRT format. ...
    4. Use the Sonix AudioText Editor to polish your SRT transcript. ...
    5. Click the 'Export' button.

    Can you extract SRT from MP4? ›

    Click the "Add Video" button to add an MP4 file and then select SRT (SubRip Text) as an output subtitle format. Step 3. Select the output path and click the "Extract Subtitles" button to extract SRT from MP4. After completing those steps above, the subtitle is extracted from the video.

    What is the best free subtitle editor? ›

    Best 10 Free Subtitle Editors for Video in 2022
    • BeeCut.
    • iMovie.
    • Filmora.
    • Clideo.
    • Subtitle Edit online BETA.
    • Subtitle Workshop.
    • VideoProc Converter.
    • AegiSub.
    15 Dec 2021

    What is the fastest way to burn subtitles to a video? ›

    Check out this section to learn the four easy and accessible solutions to burn subtitles to video quickly.
    ...
    1. Hardcode Subtitle with Happyscribe. ...
    2. Burn Subtitles into Video in VLC. ...
    3. FFmpeg. ...
    4. VideoLocalize Subtitle Burner.

    Is there an app that adds subtitles to videos? ›

    Veme.ly is an app that lets users add their own subtitles to videos. The service is mostly tailored to social media use. However, it does not include either AI speech to text software or the assistance of industry professionals. Autocap will provide automatically generated video captions.

    Is there an app that puts subtitles on videos? ›

    AutoCap is available for both Android and iOS devices. The app boasts a 'wide variety of fonts, colors and text animation'. Clips is Apple's iOS editing app that has video captioning as one of its features. The app requires you to have iOS 13.4 or later.

    What encoding is best for subtitles? ›

    SRT (Subrip) is perhaps the most basic but for sure the most widely supported of all subtitle formats. SubRip (SubRip Text) files are named with the extension . srt , and contain formatted lines of plain text in groups separated by a blank line. It is supported by all common distribution platforms.

    Which video player can generate subtitles? ›

    SubtitleBee. This is an online tool that allows generating the subtitles for your videos. Free to use, the program allows uploading videos of up to 10 minutes and then auto-search for the subtitles. Not only videos, but you can also add an MP3 audio file to get the subtitles.

    Videos

    1. Add video subtitles with ffmpeg
    (cbttjm)
    2. Add subtitles to a video #ffmpeg
    (Coding solutions)
    3. How to Easily ADD Multiple Subtitles to Video
    (Jackall Digital)
    4. How to add a new subtitle track to a video keeping everything intact?
    (Bisank's Ultimate Guide)
    5. My Top 3 Free Ways To Permanently Add, Hardcode or Burn Subtitles to Video or Movie
    (David Mbugua)
    6. Permanently add Soft Subtitles using an Android Device
    (Bisank's Ultimate Guide)

    References

    Top Articles
    Latest Posts
    Article information

    Author: Laurine Ryan

    Last Updated: 10/25/2023

    Views: 6263

    Rating: 4.7 / 5 (77 voted)

    Reviews: 84% of readers found this page helpful

    Author information

    Name: Laurine Ryan

    Birthday: 1994-12-23

    Address: Suite 751 871 Lissette Throughway, West Kittie, NH 41603

    Phone: +2366831109631

    Job: Sales Producer

    Hobby: Creative writing, Motor sports, Do it yourself, Skateboarding, Coffee roasting, Calligraphy, Stand-up comedy

    Introduction: My name is Laurine Ryan, I am a adorable, fair, graceful, spotless, gorgeous, homely, cooperative person who loves writing and wants to share my knowledge and understanding with you.