MP4 Subtitle Compatibility and FFmpeg Guide
This article provides an analysis of the limitations of the MP4 container regarding subtitle formats and explains how to use FFmpeg to successfully embed, convert, or burn subtitles into MP4 video files.
Limitations of the MP4 Container for Subtitles
The MP4 (MPEG-4 Part 14) container is widely compatible with hardware and software players, but it is highly restrictive regarding subtitle formats compared to modern containers like MKV (Matroska).
1. Limited Native Format Support
The MP4 specification natively supports only a few subtitle formats.
The primary standard for MP4 is MPEG-4 Timed Text (also
known as tx3g or mov_text). Popular formats
like SRT (SubRip) and ASS/SSA (Advanced SubStation Alpha) are not
officially supported as raw streams inside a standard compliant MP4
container.
2. Loss of Styling and Formatting
Because MP4 relies on the basic mov_text format for soft
subtitles, advanced formatting features are lost. If you attempt to
convert rich subtitle formats like ASS—which contain custom fonts,
positioning, colors, and karaoke effects—into the MP4-compatible
mov_text format, almost all styling elements will be
stripped, leaving only plain text.
3. Bitmap/Image Subtitles Incompatibility
Bitmap-based subtitles used on DVDs and Blu-rays, such as VobSub
(idx/sub) and PGS (sup), are not
natively supported by the MP4 container. Standard players will fail to
render these subtitle tracks if they are forced into an MP4 file.
How FFmpeg Handles MP4 Subtitles
FFmpeg provides two primary methods to handle these limitations: converting soft subtitles to a compatible format, or burning hard subtitles directly into the video frames.
1. Converting
Subtitles to mov_text (Soft Subtitles)
When you want to keep subtitles toggleable (soft subs) within an MP4
file, FFmpeg can convert incompatible text formats like SRT into
compliant mov_text.
To copy the video and audio streams without re-encoding, while
converting the subtitle stream to mov_text, use the
following command:
ffmpeg -i input.mkv -c:v copy -c:a copy -c:s mov_text output.mp4Note: If the input subtitle is an advanced format like ASS,
FFmpeg will strip the styling during this conversion to fit the
mov_text specification.
2. Burning Subtitles into the Video (Hard Subtitles)
If you must preserve complex styling (such as ASS effects) or ensure 100% compatibility on devices that do not support soft subtitles, you must “burn” the subtitles into the video. This process decodes the video, draws the subtitles onto the image frames, and re-encodes the video.
To burn SRT subtitles into an MP4:
ffmpeg -i input.mp4 -vf "subtitles=subs.srt" output.mp4To burn ASS subtitles (preserving fonts, colors, and positioning) into an MP4:
ffmpeg -i input.mp4 -vf "ass=subs.ass" output.mp43. Handling Stream Copy Errors
If you attempt to copy an incompatible subtitle format directly into
MP4 without specifying a encoder (e.g., using -c:s copy),
FFmpeg will either throw an error or create a non-compliant MP4 file
that most media players will fail to play correctly. Always explicitly
define the subtitle codec as mov_text when muxing soft
subtitles into MP4.