Subtitles are textual data included near the bottom of the video frame to provide additional information like a translation of the spoken foreign language to the local one, the same language subtitles to improve literacy, etc.
Subtitles can be divided into 2 main types :
- External, that is in a separate file and are included in the video frame during the playback by a media player, the advantage is that can be edited and distributed without the video.
- Internal, that are included in a media file container with the video and audio stream.
So you can encode subtitles to the video stream with one of two filters: subtitles/ass
|Description||Includes subtitles on the input video using the libass library|
Please note that not all subtitle formats are supported by all containers, most containers (AVI, Matroska, MP4, MPG, etc.) support ASS and SRT.
For example, to encode subtitles to the video stream from the file subtitles.srt to the file video.mp4, we can use the command:
ffmpeg -i video.avi -vf subtitles=titles.srt video.mp4