ffmpeg can do that fairly easily. To adjust the command in the example, you need to to take the srt file and pass it as a second -i input file. There's some helpful guides on how to do that if you search around.
e.g. https://en.wikibooks.org/wiki/FFMPEG_An_Intermediate_Guide/s...