Mark Sweeney
Author Archives: Mark Sweeney

How to Add Closed Captions to purchased iTunes movies.

In Canada, we have poor disability laws –  nothing like the ‘Americans with Disabilities Act’ where all online movies are tv shows are required to be closed captioned by law. In Canada, all we have is the CRTC’s ‘working document proposal‘, sections 51-52. (Broadcasting Regulatory Policy CRTC 2015-104). No laws. No acts. Nothing for Canadian broadcasters to comply with.

So deaf people get screwed over in Canada by Telus, Bell Media, CTV television,, and a whole host of other Canadian broadcasters that can’t be bothered to close caption online content.

Apple’s iTunes Canada is somewhat better. Almost all new movies are closed captioned. However, once in a while, you’ll find a movie on iTunes Canada that isn’t closed captioned. Tonight, it was Cairo Time, a 2009 movie. To add insult to injury, it’s closed captioned in the US store. <head-desk>

However, if you can find English Subrip subtitles online (.srt file), and you have a Mac, you can add closed captions yourself.

You’ll need to download a program called Subler. The movie below shows the steps involved.

Note – this does not remove or modify the FairPlay DRM. You’ll still need iTunes or an Apple device to play the movie.

Adding WebVTT Closed Captioned videos in html.

Image of video player displaying WebVTT Closed Captions

Still image from Night of the Living Dead showing WebVTT Closed Captions on screen.

Below is the html for adding WebVTT Closed Captions to this video.

<!DOCTYPE html>
<video width="796" height="597" controls>
<source src="VIDEO_URL/VideoCaptioned.mp4" type="video/mp4" />
<track src="VideoCaptioned.vtt" kind="captions" label="Closed Captions" srclang="en" type="text/vtt" />

Above is the html code for displaying an mp4 video with WebVTT Closed Captions. The user will be able to turn Closed Captions on or off as they see fit.

For an example of html5 video with Closed Captions, you can visit to see a scene from George Romero’s “Night of the Living Dead.”

Breaking down the important bits of the code:

You need

<!DOCTYPE html>

or it won’t work in Windows 8.

<video width="796" height="597" controls>

Sets the width and height of the dimensions of your video. Change these to match your video. “controls” is gives the user the little bar at the bottom of the video with all the video controls, including the Closed Caption [CC] button.

<source src="VIDEO_URL/VideoCaptioned.mp4" type="video/mp4" />

VIDEO_URL/VideoCaptioned.mp4 – This is the URL address where your video is stored. This tells the browser where the file is, and what kind it is. Your WebVTT text file should also be in the same folder as the video. This way, all you need is the name of the video file and its extension, rather than an entire URL.

track src="VideoCaptioned.vtt"

Your WebVTT text file should also have the same name as your video. “My-Video.mp4” and “My-captions.vtt” won’t work. The file names for the video and the WebVTT files need to be the same, just with different extensions (“.mp4”, and “.vtt”).” Don’t forget, file names can’t have spaces in html, or links to them won’t work.


This tells your browser what kind of captions they are – captions, subtitles, descriptions, chapters and metadata are they are.

Subtitles are different that captions. Captions often include sounds heard, such as “Phone rings”, or “thunder” etc. Subtitles are usually just dialogue, and you can have several subtitles in different languages. In this case, we’re using captions.

label="Closed Captions"

Label is how the captions track name shows up when the user clicks the Closed Captioned [CC] button.


This adds “(English)” after the “Closed Captions” label.


Type tells most browsers what kind of file to expect. Most of them can use this, but Windows 8 needs more attention.


For WebVTT to work in Windows 8,  you need to upload a special text file with the name “.htaccess” (without the quotation marks) to the root folder of your server.

In that text file, you need one line of text:

AddType text/vtt .vtt

This allows Windows 8 to read the .vtt text file properly. Otherwise, the video will show options for Closed Captions, but not the captions themselves.

More information on how to create the .htaccess file on PC or Mac can be found here:

The .htaccess should be in the root folder of your domain. If it is in a subfolder, it will only affect the contents of that folder.


WebVTT Closed Caption Testing

I’ve been spending more time learning about WebVTT, a W3C standard for displaying timed text in connection with the HTML5 element – i.e. Closed Captioning for Internet Videos. It took about a day to get it working on Mac Safari, iOS Safari, Chrome for Android tablet, Windows Phone 8.1, Windows (PC) 8.1, and Windows 10.

You can see the video down below, and through this link.

Both the Desktop and Mobile versions of Windows 8.1 were the biggest pains. I finally figured out I needed a .htaccess file on my server with the following line of code:

AddType text/vtt .vtt

This is a plain text file in the main directory of the server with the name “.htaccess” that lets Windows 8 read the .vtt file. Windows 10 didn’t need this.

If you are on a Mac, iOS, Android, Windows 8 or Windows 10 you can watch a Scene from George Romero’s “Night of the Living Dead” with WebVTT Closed Captions (don’t forget to turn on the Closed Captions in settings for whichever platform & device you have).


To have the video show up in WordPress with captions took a little work as well. Straightforward html like in this link, didn’t work.

Upload your video and WebVTT files at the same time using WordPress’s Add Media button.

Select the video file and hit the Insert into post button. In Visual View, select the movie, and select “Edit” as shown below.


In the next window, select “Add Subtitles”



Select the WebVTT file in your media library, and your video should now have a Closed Caption [CC] button.


Currently, the html version of this ( works with:

  • Mac Safari OS X El Capitan
  • Mac Firefox
  • iOS 9.2 Safar1
  • Windows 8.1 Explorer (desktop)
  • Windows 8.1 Explorer (mobile)
  • Windows 10 Edge (desktop)
  • Android 5.1

I’ll add more browsers/platforms to the list as I test them out.

Don’t Use Youtube’s Auto-Caption to create subtitles.

Don’t use Youtube’s “Auto-Caption” – it does a terrible job. Below is Youtube’s “translation” of spoken audio to auto-captions.


Youtube’s Auto-Captions are horrible. It should really be called Auto-Craption. It leaves out punctuation, turning everything into a run-on paragraph. Words and phrases it doesn’t understand are mistranslated, creating captions that, at best makes no sense. At its worst, you’ll be laughing at how horrible the captions are.

Far better to just do Closed Captions for Youtube properly. The best part is the software doesn’t cost you a cent. You can use AegisSub. It’s free, and works with OS X, including the newly released Yosemite.

It’s pretty easy to use. Transcribe your audio, then set up timing so each subtitle appears when spoken. When you’re done, export the subtitles as a .srt (SubRip) file. Go to your Youtube page, select the video, and upload the .srt file.

Unity3D: Direct Function calling vs SendMessage

Comparing calling a function directly in a script vs using SendMessage to a Game Object.

Two counters start simultaneously, counting to 1,000 and sending the int ‘1’ to a function in another script.

SendMessage uses:

Direct Function uses:

SendMessage takes just over twice as long to perform the same feat as Direct Function (209%).


SendMessage has an advantage in that you don’t need to know the name of the script on the GameObject you’re sending the message to. Direct Function needs to know the name of the script.

Aside from being faster, Direct Function can also send more than one parameter to a function in another script, so you could send a string, float, int, Vector2, Vector3 and more in one single code, provide the function you’re sending them to can receive those parameters.


crScript.countem(13.509Quote thisVector2(1.0,2.0), Vector3(2.5,3.5,4.5));


You can find the example project from the video above here: SendMessage vs Direct Function