Hard subs, soft subs, external subs... the names alone can make your head spin, not to mention the issue of some players showing them while others don't. If you're always getting tripped up by these problems, this guide is for you. From the basic differences between subtitle types to hands-on FFmpeg operations, we'll clarify everything step by step, simply and practically!
I. Understanding Subtitle Types
1. Hard Subtitles (Burned-In Subtitles)
- Definition: Subtitles are directly rendered into the video frame, becoming part of the image.
- Characteristics:
- Cannot be turned off; permanently displayed.
- Extremely high compatibility; can be played on any device.
- Style (font, color, etc.) is fixed and cannot be adjusted.
- Suitable Scenarios:
- Anti-piracy measures (e.g., watermarks on film and television platforms).
- Subtitle display on low-end devices (e.g., older TVs).
2. Soft Subtitles (Embedded Subtitles)
- Definition: Subtitles are packaged as an independent track within the video file (e.g., 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 (e.g., switching between English and Chinese subtitles in movies).
- Streaming media distribution (e.g., Netflix).
3. External Subtitles
- Definition: Independent subtitle files separate from the video (e.g.,
.srt
,.ass
) that need to be manually loaded. - Characteristics:
- Flexible for editing; does not affect the original video.
- Usually needs to be stored with the same name as the video (e.g.,
video.mp4
+video.srt
). - Relies 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 special effects (color, animation, position) |
Style Control | Relies on player's default settings | Customizable font, size, color, etc. |
Compatibility | Supported on almost all platforms | Requires a player that supports ASS (e.g., VLC) |
File Size | Extremely small | Slightly larger (contains style code) |
Suitable Scenarios | Basic subtitles, multilingual support | Special effect subtitles, complex layout requirements |
SRT Subtitle Format Requirements
- Basic Components:
- Sequence Number: The number of each subtitle segment, incrementing from 1.
- Timeline: Display start and end times, in the format hour:minute:second,milliseconds --> hour:minute:second,milliseconds.
- Subtitle Content: Plain text, supports line breaks, with each segment separated by a blank line.
- Requirements:
- File encoding is recommended to be UTF-8 (to avoid garbled characters).
- The timeline needs to be precise, 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 the SRT subtitle experience!
2
00:00:04,000 --> 00:00:06,000
This is the second subtitle segment.
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, supporting special 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 segment.
- 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 the ASS subtitle experience!
Dialogue: 0, 0:00:04.00, 0:00:06.00, Default, {\pos(640,360)}This is the second subtitle segment, centered.
III. How to Choose a Subtitle Embedding Method?
1. Choose Based on Needs
- Hard Subtitles: Forcing display (e.g., promotional videos) or target devices do not support soft subtitles.
- Soft Subtitles: Need flexible on/off control (e.g., multilingual videos) and want to preserve the original image quality.
- External Subtitles: Temporary use or frequent modification of subtitle content is required.
2. Choose Based on Format
- SRT: Only basic text is needed, no special effect requirements, suitable for cross-platform distribution.
- ASS: Need to set font, size, color, and other effects, and users use players that support ASS.
IV. FFmpeg Practical Operations
1. Embed Hard Subtitles (Retain ASS Effects)
bash
ffmpeg -i input.mp4 -vf "ass=subtitle.ass" -c:a copy output.mp4
- Description: Render the ASS subtitle onto the screen, retaining the effects, and directly copy the audio stream to improve efficiency.
2. Embed Soft Subtitles (SRT or ASS)
bash
# Embed 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
# Embed 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. Forcefully Specify Hard Subtitle Style (Override 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 Description:
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 be displayed at the same time?
- Usually not: Players (such as VLC) prioritize loading external subtitles and can manually switch tracks.
- If they overlap: Turn off one track 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 if ASS effects fail in MP4?
- Reason: MP4's
mov_text
does not support complex ASS effects. - Solution:
- Use 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 (retain effects but lose flexibility).
- Use MKV container (supports ASS native embedding):
VI. Ultimate Choice Recommendations
Scenario | Recommended Solution |
---|---|
Simple subtitles, pursuing compatibility | SRT soft subtitles or hard subtitles |
Special effect subtitles, local playback | ASS hard subtitles or MKV soft subtitles |
Multilingual needs | Multi-track SRT soft subtitles |
Streaming media platform upload | SRT soft subtitles (platform optimization) |
VII. Other Useful Tips
Check Subtitle Encoding
- If subtitles are displayed as garbled characters, check the file encoding (UTF-8 is recommended). Tools such as Notepad++ can be used for conversion.
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: