[00:00] Hey, welcome back. Here's a stat that should make every video creator stop and think. 83% of people watch videos with sound off. They could be commuting, sitting in a quiet office, [00:15] multitasking, or simply don't have their headphones with them when they're outside. If there are no subtitles to follow along with, they're likely to scroll past it. If you're a developer building a video editing tool, [00:30] or anything that handles video, this is your phone to add subtitle support. In this video, I'm going to show you how to add subtitles to any video file using FFM tape, [00:44] a free, powerful command line tool. By the end of the video, you'll know how to add both hard and soft subtitles to videos. Let's start with hard subtitles. These subtitles are permanently [00:58] backed into the video frames. Once they're added they can't be removed. An SRT file has four parts per subtitle entry. An index number, a start and end [01:12] timestamp, the subtitle text, and a blank line to indicate the end of the subtitle. Make sure the SRT file is in the same folder as your video and run this [01:25] Here's what the command means. dash i inputs dot mp4 specifies the source video dash vf subtitles equals subtitle dot srt applies the subtitles filter [01:46] and specify the name of the srt subtitles file and finally output underscore srt dot mp4 specifies the name of the output file. [01:59] This adds the hard coded subtitle to the video using the default font style. If you want more styling control, convert your SRT file to an .ass file first using the command. The .ass format gives you control [02:18] over font name, size, color, bold, italic, alignment, margins and more. Once you've configured the styles in the file, apply it to your video with an AFF filter. [02:34] The styling will be applied to the subtitles, like how it's defined in the AFF file. Now, let's add soft subtitles. Unlike hard subtitles, these are not burned into the [02:48] video. They're embedded as a separate stream, so viewers can turn them on or off using their media player. This is great for accessibility and also for [03:01] supporting multiple languages. Before we start, rename your subtitle file to subtitle Then run this command Here the result You can see the subtitle stream is there in the player and you can switch it on or off [03:25] Let's break down the command that we just learned. Two files following "-i", are the video and subtitle files. "-ccopy", tells FFmpeg not to re-encode the video. [03:40] "-csmaz", converts the SRT stream to MOV underscore text format, which is what MP4 containers use. [03:52] And dash metadata SS0 language argument tags the subtitle stream as English using the ISO639 language code. [04:05] Basically, the command takes the video and embeds the subtitle file as a toggleable English subtitle stream without re-encoding the video, outputting it as output underscore English [04:21] dot mp4. Now let's add a Chinese subtitle to the video we just created. another file name subtitle.chi.srt with Chinese subtitles inside, we'll use [04:37] dash map flag to tell FFmpeg which streams to include. Dash map 0 includes everything from the previous output video including the English subtitle [04:52] stream and dash map one adds the Chinese SRP as an additional stream metadata ss one language tag marks the second subtitle stream as Chinese Let run the command [05:10] Now you can choose which subtitle to show. If you want to go from scratch and add both language subtitle streams in a single pass, here's the one-liner. Before we end [05:24] this video, let's quickly compare the two methods. Hard subtitles burn the text permanently into the video frames. You can't remove them and viewers can't toggle [05:38] them off, but they'll show up on any media player without any compatibility concerns. Use these when you need the subtitles to always be there. On the [05:50] other hand, SCUF subtitles are embedded as a separate stream. Viewers can turn them on or off and you can pack multiple languages into a single file. They're [06:02] also faster to process since FFmpeg skips re-encoding entirely. Use these when you're producing content for platforms that support subtitle tracks like a video app, [06:16] a streaming platform or a downloadable file where your audience speaks different languages. And that's a wrap. If you have any questions or any tutorials that you want to see, [06:31] drop them in the comments below. I'll see you for the next one.