If you watch movies with mplayer or vlc, you do not need to know that this trick even exists. But if you want to watch a video on a tablet, or your smartphone, you may need to embed the subtitle to the avi file.
In this article I will show you how to embed subtitle to videos, with both mencoder and ffmpeg.
For both this methods, move the video and the subtitle file in the same directory, to make your work easier:
$ mkdir -p ~/videos/linuxg_example
cp ~/downloads/video.avi ~/videos/linuxg_example
cp ~/downloads/subtitle.srt ~/video/linuxg_example
Go to the folder where you have the video and the subtitle:
$ cd ~/videos/linuxg_example
Method one, with ffmpeg:
$ ffmpeg -i video.avi -vf subtitles=subtitle.srt output_video.avi
Method two: with mencoder:
$ mencoder video.avi -oac copy -ovc lavc -sub subtitle.srt -subfont-text-scale 3 -o output_video.avi