Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I would like to make a subtitle file to be a part of an mp4 video file, so that I don't have to deal with two separate files.

I imagine two ways:

  • Make the subtitle an intrinsic part of the video. This will require video re-encoding.
  • Make the subtitle a separate stream, but still embedded in the same video file. This is far more preferable, especially because I can disable it (unlike the other approach), or even play with the font type/size.

How do I do things the 2nd way? It would also be kool to know how the 1st approach works.

share|improve this question
I haven't worked it out yet, but I'm very interested... It seems that the mp4 (MPEG-4) container can handle seperate emedded suptitle streams.. so (to me) that would be the way to go.. If you you hard-graft the subtitles into the video itself, you need to re-encode the video and they are embedded forever... The only advantage of hard-"coded" subtitles is that the video player doesn't need to be mp4-subtitle-stream aware... It's quite straight forward to hard encode an AVI , but I haven't had the need to use sutitle streams yet (yet :). Where is the format of your subtitles? – Peter.O Feb 11 '11 at 1:42
@fred My subtitle file ends with .srt, and Nautilus tells me the format is SubRip subtitles (application/x-subrip). – Tshepang Feb 24 '11 at 13:07

The Matroska (mkv) container format supports text-based subtitles embedded as a separate stream into the file.

You could use mkvmerge to remux the file to .mkv and include the subtitles in the output, which you can enable/disable when playing the video. Note that this method will NOT re-encode the video or audio, it's just putting the same data into a different container format, so it will not decrease the quality of the video.

mkvmerge -o output.mkv video.mp4 subtitles.srt
share|improve this answer

In a package called gpac, there is a CLI utility called MP4Box

Here is an example of what worked for me..

MP4Box  -add ~/file.noaudio.mp4 \
        -add ~/file.mp3 \
        -add ~/file.srt \

I used a video-only and audio-only, but it will surely(?) work with a normal audio+video "movie" .... It's very late so I'll just leave it at that...

Note: The subtitles works in Totem, but not in SMPlayer...

share|improve this answer

Try something like:

mencoder -oac copy -ovc copy -sub subs.srt video.mp4 -o new_video.mp4
share|improve this answer
That doesn't work. It results in mangled audio and video, and the video is truncated (initial file is ~1.6GB and resulting file is ~200MB). I use mencoder 1.0-rc3. – Tshepang Feb 11 '11 at 9:06
I have an mp4 file and an srt. But with these arguments the subtitle does not appear on the resulting file. :( – TrueY Oct 13 '14 at 21:09

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.