Play a Local Video with Subtitles
Now, let's overlay a message onto media we're casting from our laptop. This means we'll be able to communicate on two layers, with the content of the video we are playing, and with subtitles played very visibly over the video as it plays.
To do this, we'll need to make an SRT file, which we can do in nano. In a terminal window, type the following to create a subtitles file.
Then paste the following into the text file. You can modify the text, but the point is seeing how the format works. On the top, you have a 0 for where everything starts. Then you have a number for each block of text, a time code for how long the text is displayed, and then the text to display under it.
0 00:00:01.530 --> 00:00:03.629 HERE IS SOME TEXT 1 00:00:03.629 --> 00:00:07.819 OH WOW LOOK AT THAT BIG TEXT 2 00:00:07.819 --> 00:00:08.740 IT IS SO HUGE AND BIG OH 3 00:00:08.740 --> 00:00:13.370 SOME MORE SAMPLE TEXT HERE BUT 4 00:00:13.370 --> 00:00:14.660 there is no need to shout 5 00:00:14.660 --> 00:00:17.699 Never use Priceline 6 00:00:17.699 --> 00:00:22.720 More text to test 7 00:00:22.720 --> 00:00:26.300 Here is some sample text 8 00:00:26.300 --> 00:00:30.000 please pay me with a credit card
When you're done creating your text file, type Ctrl-x and then y to save and close the file.
Now, we should have a Demo.srt file to cast along with a local video. It's easy to cast a local video; simply specify the file path after typing catt cast and you should see the video begin to play. To specify we want subtitles, we'll add the -s flag. In the format below,
substitute "/yourvideo.mp4" with the location of your video file.
catt cast -s ./Demo.srt ./yourvideo.mp4Casting local file yourvideo.mp4... Using subtitle /Users/skickar/Desktop/Demo.srt Playing yourvideo.mp4 on "Probe Team CIC"... Serving local file, press Ctrl+C when done. 192.168.0.91 - - [21/Jan/2019 07:00:41] "GET /?loaded_from_catt HTTP/1.1" 200 - video/mp4 - 786.90 MB 192.168.0.91 - - [21/Jan/2019 07:00:41] "GET //var/folders/n1/l_2ynlx91lv57t122lq8lkyh0000gn/T/tmpxxljn3ds.vtt HTTP/1.1" 200 - text/vtt;charset=utf-8 - 1.69 KB
Just like that, you should see your video and subtitle message begin to play! I changed my example text a bit before it played.@hackersworldunite