Home Linux Blog Memories Me About ?

Dear My



Some days ago I learned how to subtitle a Video with hard-subs; even tough I achieved to do it in this way, I think there may exist a more straightforward method. I would have used kdenlive but since I use Gentoo I think a command line method is the correct one because I want to avoid everything related to KDE in my Gentoo.

Step one. Create an mp4 with soft-subs:

The additional step I did was because I needed to specify the encoding for my Spanish subs (ISO-8859-1) , because if you try only the burn the subtitle using only the second step it will ask you to use -sub_charenc parameter.

The maps parameters are important since they mean that the video track plus the subtitle track and the audio track will be all included.

ffmpeg -i mozart.mp4 -sub_charenc ISO-8859-1 -i Desktop/Mozart.And.The.Whale.2005.LiMiTED.DVDRip.XviD-LiNE.srt -map 0:0 -map 0:1 -map 1:0 -vcodec copy line-mozart.mp4

Step two. Create the hard-subs

ffmpeg -i line-mozart.mp4 -filter:v subtitles=line-mozart.mp4 out.mp4