See official wiki and subtitles docs.
subtitles video filter
If the subtitle is a separate file called subtitle.srt, you can use this command:
ffmpeg -i video.avi -vf subtitles=subtitle.srt out.avi
If the subtitle is embedded in the container video.mkv, you can do this:
ffmpeg -i video.mkv -vf subtitles=video.mkv out.avi
Note that the subtitles video filter opens the file separately, so if you are also Seeking in the same step, then the subtitles will start at the beginning of the subtitle file. This may or may not be what you want. If you want the burned-in subtitles to start at the same timestamp as the video, you will need to copy the timestamps to the output with -copyts, and then additionally seek in output again with the same values that were used for the input. For example, if you wish to start both the output video and subtitles to start 5 minutes into the input file, then you can use a command line this:
ffmpeg -ss 5:00.00 -copyts -i video.avi -ss 5:00.00 -vf subtitles=subtitles.srt out.avi
subtitles options
For example, to render the file sub.srt on top of the input video, use the command:
subtitles=sub.srt
which is equivalent to:
subtitles=filename=sub.srt
To render the default subtitles stream from file video.mkv, use:
subtitles=video.mkv
To render the second subtitles stream from that file, use:
subtitles=video.mkv:si=1
To make the subtitles stream from sub.srt appear in 80% transparent blue DejaVu Serif, use:
subtitles=sub.srt:force_style='Fontname=DejaVu Serif,PrimaryColour=&HCCFF0000'