Soft subtitles

Add an SRT to an MP4 without burning it in.

To put an SRT inside an MP4 as a subtitle track viewers can switch on and off, mux it with ffmpeg and convert it to MP4's own subtitle format on the way: ffmpeg -i video.mp4 -i subtitles.srt -map 0 -map 1 -c copy -c:s mov_text output.mp4. Nothing is re-encoded, so it takes seconds and the picture is untouched. If you do not have the SRT yet, that is the part suubbs does — it writes one from the video's audio on your own Mac.

Get the Mac app — $9.99 → Try it free in your browser
Before you start

Embedded is not the same as burned in.

Two ways to get subtitles into one file, with opposite trade-offs.

An MP4 is a container: it holds a video stream, one or more audio streams, and optionally one or more subtitle streams, side by side. Adding a subtitle track — "soft" or "embedded" subtitles — puts the text in the container next to the picture. The player draws it, in the player's own style, and the viewer can turn it off or pick another language. The video stream is copied bit for bit.

Burning in draws the words into the pixels instead. They look the same everywhere and nobody can switch them off, but it means re-encoding the whole video, and a typo is permanent. That route is covered in burning subtitles into a video.

Embed when the subtitles are for the person watching the file: a film you are sending to someone, a video library, an archive copy with several languages in it. Burn in when the look is the point, or when the video is going somewhere that will not show a subtitle track — most social feeds.

Step by step

From a video to an MP4 with a subtitle track.

Four steps, one of them a command.

  1. Make the SRT from the final cut. Subtitle times are counted from the first frame, so the SRT has to come from the same edit you are putting it into. Drop the exported video into suubbs, press Generate, and correct anything it misheard — improving subtitle accuracy covers the settings that reduce how much there is to fix.
  2. Export the unstyled SRT. In suubbs, ⋯ → SubRip, unstyled. The regular Export .srt can carry colour, font, size, bold and italic tags when you have styled the captions; a player draws an embedded track in its own style, so the unstyled file is the predictable one to embed.
  3. Get ffmpeg. It is free; on a Mac the usual install is brew install ffmpeg through Homebrew.
  4. Mux the two together. In Terminal, in the folder holding both files:
    ffmpeg -i video.mp4 -i subtitles.srt \
      -map 0 -map 1 -c copy -c:s mov_text \
      -metadata:s:s:0 language=eng \
      output.mp4

Open output.mp4 and switch the subtitles on from your player's subtitle menu. Your original file is not changed.

What the command does

Every part of it, and why it is there.

So you can change it without guessing.

Two languages in one file

Add an input and a map per subtitle file, and label each track:

ffmpeg -i video.mp4 -i english.srt -i spanish.srt \
  -map 0 -map 1 -map 2 -c copy -c:s mov_text \
  -metadata:s:s:0 language=eng \
  -metadata:s:s:1 language=spa \
  output.mp4

Turn a track on by default

Players normally start with subtitles off. To ask for the first track to be shown automatically, add -disposition:s:0 default. Whether a player honours it is up to the player.

Check what is in the file

ffprobe output.mp4 lists every stream. A line containing Subtitle: mov_text is the track you added; if it is missing, the -map options were left out.

The SRT is the hard part.

[made on your own Mac]

Keeping the style

MP4 tracks are plain. MKV can carry the look.

If you styled the captions, the container decides whether the style survives.

An embedded MP4 track gives the player the words and the timing, and the player decides what they look like. A backing box, an exact position, a word-by-word highlight — the things you set in the suubbs style panel — do not travel in it.

If you want the styled captions as a switchable track, export ⋯ → Advanced SubStation (.ass) and put it in an MKV instead. Matroska stores ASS as it is, so no conversion is needed:

ffmpeg -i video.mp4 -i subtitles.ass -map 0 -map 1 -c copy output.mkv

Players that draw subtitles with libass, such as mpv and VLC, then render the styling from the file. Two caveats. An ASS file names its font but does not contain it, so a viewer without that font sees a substitute. And not every player renders ASS styling, or plays MKV at all — the ASS subtitle file page goes into what the format holds.

If the look has to be identical on every screen, embedding is the wrong tool and burning in is the right one.

MOV and M4V

The same mov_text command works for .mov and .m4v files: change the file names and keep the options.

Where it will not show

Places that ignore an embedded track.

An embedded track only helps where the player looks for one.

When the subtitles are early or late

If the track plays but every line is off by the same amount, the SRT was made from a different cut than the video — an intro added, a trim at the start. Make it again from the final export, or, for an offset of up to three seconds either way, shift every cue at once with the sync slider in suubbs' Timing & layout sheet and re-export. Fixing subtitle sync covers drift and frame-rate problems too.

Questions

What people ask next.

Mostly about ffmpeg.

How do I add an SRT file to an MP4 permanently?

Mux it into the MP4 as a subtitle track with ffmpeg: ffmpeg -i video.mp4 -i subtitles.srt -map 0 -map 1 -c copy -c:s mov_text output.mp4. The subtitles are then inside the file and travel with it, and viewers can still switch them off. If they must never be switched off, burn them in instead.

Why does ffmpeg say it could not find a tag for codec subrip?

MP4 cannot hold SRT as it is. Add -c:s mov_text so ffmpeg converts the subtitles to MP4's own text subtitle format while copying the video and audio unchanged.

Does adding subtitles re-encode the video?

No. With -c copy the video and audio streams are copied exactly; only the subtitle text is converted. It is fast and loses no quality. Burning subtitles in is what requires a re-encode.

Can I keep my caption styling in an MP4?

Not reliably — an MP4 subtitle track is drawn in the player's own style. Put a styled ASS file in an MKV for players that render ASS, or burn the ASS in to get the same look everywhere.

Can I put more than one language in the same MP4?

Yes. Add each SRT as another input, map it, and label each track with -metadata:s:s:N language=xxx. The viewer picks the language from the player's subtitle menu.

How do I get the subtitles back out of an MP4?

ffmpeg -i video.mp4 -map 0:s:0 subtitles.srt extracts the first subtitle track as an SRT. To make a copy with no subtitle tracks at all, use ffmpeg -i video.mp4 -map 0 -c copy -sn clean.mp4. Extracting subtitles from a video covers choosing a track by language, keeping ASS styling, and what to do when there is no track.

Can suubbs put the subtitles into the MP4 for me?

No. suubbs makes and exports the subtitle file — SRT, WebVTT, styled ASS or word-level JSON — and does not write video files. The ffmpeg command above is the one step after it.

I do not have an SRT. How do I make one?

Transcribe the video's audio. Drop the video into suubbs, press Generate, correct the words, and export SubRip. It runs on your own Mac with nothing uploaded; the free browser version does the first 60 seconds.

Keep reading

Related

Make the SRT. Mux it in seconds.

[nothing uploaded]