Hard subtitles, soft subtitles, external subtitles – the names alone can be confusing, not to mention that some players display subtitles while others don't. If you're often puzzled by these issues, this guide is for you. From the basic differences between subtitles to hands-on FFmpeg operations, we'll clarify everything step by step in a simple and practical way!
I. Understanding Subtitle Types
1. Hard Subtitles (Burned-in Subtitles)
- Definition: Subtitles are directly rendered onto the video frame, becoming part of the image.
- Characteristics:
- Cannot be turned off, always displayed.
- Highly compatible, playable on any device.
- Style (font, color, etc.) is fixed and cannot be adjusted.
- Suitable Scenarios:
- Anti-piracy measures (such as watermarks on film platforms).
- Subtitle display on low-end devices (such as older TVs).
2. Soft Subtitles (Embedded Subtitles)
- Definition: Subtitles are packaged as an independent track within the video file (such as the
mov_text
track in MP4). - Characteristics:
- Can be turned on/off or switched between languages.
- Requires player support (some devices may not recognize them).
- Style can be customized by the player.
- Suitable Scenarios:
- Multilingual videos (such as switching between English and Chinese subtitles in movies).
- Streaming media distribution (such as Netflix).
3. External Subtitles
- Definition: Independent subtitle files (such as
.srt
,.ass
) that need to be loaded manually. - Characteristics:
- Flexible editing without affecting the original video.
- Usually stored with the same name as the video (e.g.,
video.mp4
+video.srt
). - Depends on player support.
- Suitable Scenarios:
- Temporary use or frequent adjustments to subtitle content.
II. Comparison of Mainstream Subtitle Formats: SRT vs ASS
Feature | SRT | ASS |
---|---|---|
Functionality | Plain text (timeline + text) | Supports effects (color, animation, position) |
Style Control | Depends on player's default settings | Customizable font, size, color, etc. |
Compatibility | Almost universally supported | Requires ASS-supporting players (e.g., VLC) |
File Size | Extremely small | Slightly larger (contains style code) |
Use Cases | Basic subtitles, multilingual support | Special effects subtitles, complex layout requirements |
SRT Subtitle Format Requirements
- Basic Components:
- Sequence Number: The number of each subtitle segment, starting from 1 and incrementing.
- Timeline: Display start and end times, in the format Hours:Minutes:Seconds,Milliseconds --> Hours:Minutes:Seconds,Milliseconds.
- Subtitle Content: Plain text, supports line breaks, with each content segment separated by a blank line.
- Requirements:
- File encoding is recommended to be UTF-8 (to avoid garbled characters).
- The timeline must be accurate, with three digits for milliseconds after the comma.
- No style control, completely relies on player rendering.
1
00:00:01,000 --> 00:00:03,500
Hello, welcome to SRT subtitles!
2
00:00:04,000 --> 00:00:06,000
This is the second subtitle.
ASS Subtitle Format Requirements
- Basic Components:
- Header Information: Defines subtitle styles and metadata (e.g., resolution, font).
- Events Section: Contains the timeline and specific subtitle content, supports effects.
- Requirements:
- The file starts with [Script Info], setting global information.
- [V4+ Styles] defines styles (e.g., font, color).
- [Events] lists the time and content of each subtitle.
- Supports complex effects (e.g., position, animation), which need to be controlled with specific tags.
[Script Info]
Title: Sample ASS Subtitle
ScriptType: v4.00+
PlayResX: 1280
PlayResY: 720
[V4+ Styles]
Format: Name, Fontname, Fontsize, PrimaryColour, Alignment
Style: Default, 微软雅黑, 36, &H00FFFFFF, 2
[Events]
Format: Layer, Start, End, Style, Text
Dialogue: 0, 0:00:01.00, 0:00:03.50, Default, Hello, welcome to ASS subtitles!
Dialogue: 0, 0:00:04.00, 0:00:06.00, Default, {\pos(640,360)}This is the second subtitle centered.
III. How to Choose a Subtitle Embedding Method?
1. Choose According to Needs
- Hard Subtitles: Forcing display (e.g., promotional videos) or when the target device does not support soft subtitles.
- Soft Subtitles: Need flexible on/off control (e.g., multilingual videos) and want to preserve the original quality.
- External Subtitles: Temporary use or need to frequently modify subtitle content.
2. Choose According to Format
- SRT: Only basic text is needed, no special effects requirements, suitable for cross-platform distribution.
- ASS: Need to set font, size, color, and other effects, and users use ASS-supporting players.
IV. FFmpeg Practical Operations
1. Embedding Hard Subtitles (Retaining ASS Effects)
bash
ffmpeg -i input.mp4 -vf "ass=subtitle.ass" -c:a copy output.mp4
- Explanation: Renders ASS subtitles onto the screen, retaining effects, and directly copies the audio stream for efficiency.
2. Embedding Soft Subtitles (SRT or ASS)
bash
# Embedding SRT
ffmpeg -i input.mp4 -i subtitle.srt -c:v copy -c:a copy -c:s mov_text -metadata:s:s:0 language=chi output.mp4
# Embedding ASS (Effects may be lost)
ffmpeg -i input.mp4 -i subtitle.ass -c:v copy -c:a copy -c:s mov_text output.mp4
- Note: MP4's
mov_text
does not support ASS effects, it is recommended to use MKV instead.
3. Forcibly Specifying Hard Subtitle Styles (Overriding Original ASS Settings)
bash
ffmpeg -i input.mp4 -vf "subtitles=subtitle.ass:force_style='FontName=微软雅黑,FontSize=24,PrimaryColour=&H00FFFFFF'" -c:a copy output.mp4
- Parameter Explanation:
FontName
: Font name (must be supported by the system).FontSize
: Font size.PrimaryColour
: Color (&HBBGGRRAA
, e.g.,&H00FFFFFF
for white).
V. Frequently Asked Questions
1. After Embedding Soft Subtitles, Will External Subtitles Also Be Displayed?
- Usually Not: Players (such as VLC) prioritize loading external subtitles, and you can manually switch tracks.
- If Overlapping: Turn off one of the tracks in the player settings.
2. How to Embed Multilingual Subtitles?
bash
ffmpeg -i input.mp4 -i chs.srt -i eng.srt -c:v copy -c:a copy -c:s mov_text -metadata:s:s:0 language=chi -metadata:s:s:1 language=eng output.mp4
- When Using: Switch language tracks through the player menu.
3. What to Do If ASS Effects Fail in MP4?
- Reason: MP4's
mov_text
does not support complex ASS effects. - Solution:
- Use the MKV container (supports ASS native embedding):bash
ffmpeg -i input.mp4 -i subtitle.ass -c:v copy -c:a copy -c:s copy output.mkv
- Convert to hard subtitles (retains effects but loses flexibility).
- Use the MKV container (supports ASS native embedding):
VI. Ultimate Choice Recommendations
Scenario | Recommended Solution |
---|---|
Simple subtitles, pursuing compatibility | SRT soft subtitles or hard subtitles |
Special effects subtitles, local playback | ASS hard subtitles or MKV soft subtitles |
Multilingual needs | Multi-track SRT soft subtitles |
Streaming platform upload | SRT soft subtitles (platform optimization) |
VII. Other Practical Tips
Check Subtitle Encoding
- If subtitles display garbled characters, check the file encoding (UTF-8 recommended). You can use tools like Notepad++ to convert it.
Timeline Adjustment
- Use FFmpeg to adjust subtitle delay:bash
ffmpeg -i input.mp4 -vf "subtitles=subtitle.srt:si=0:setpts=PTS-STARTPTS+0.5/TB" output.mp4
0.5
indicates a delay of 0.5 seconds, which can be adjusted.
- Use FFmpeg to adjust subtitle delay: