Register  |  Login  |  United States (change)

Displaying your closed captions in Windows Media Player

by Gary Rebholz


With the improvements that we made to the closed captioning workflow in Vegas Pro 10 software, you can now create and export closed caption files for use with the videos you encode to WMV format whether for inclusion on a disc or for streaming over the web. That part's easy and we explain the exact techniques for doing so in our extensive training video that you'll find on the Seminar Series training package for Vegas Pro 10 software. In this article, I'll talk about how you can make those WMV closed captions viewable in the Windows Media Player.


I'll let you know up front that later in this discussion we dig into issues involving HTML and cascading style sheet code, so if you're not familiar with those technologies, you might find yourself feeling a little left behind. But if you're going to include closed captioning with your WMV files, you may want to gain at least a fundamental understanding of those topics in order to take full advantage of what we discuss here. Or else, find someone that can help you with that part of the process!


But that comes a bit later. First, once you've added and edited your closed caption markers to the Vegas Pro timeline, you can easily export them as Synchronized Accessible Media Interchange, or SAMI files — the type of file that Windows Media Player needs for displaying them. To export your closed captions, choose Tools | Scripting | Export Closed Captioning for Windows Media Player. In the Save Closed Caption as SAMI dialog box, shown in Figure 1, choose your save location and choose a name for the file. To make it all work, make sure to save the file to the same folder that you'll use to save the corresponding WMV file. And to make it easier on yourself, give the SAMI file the same name as the WMV file. When you're done, click Save.


Figure 1

Use the Export Closed Captioning for Windows Media Player script to export your closed captions.


Now, render your project as a WMV as you normally do. When you're done, you have all the pieces ready. Now you just need to make it work. Unfortunately, as I said, that's not as straight-forward as the Vegas Pro part of the process is.


When you deliver your WMV file, you have two basic options. First, you can deliver it as a standalone object so that when the user launches it — whether directly from a disc or from a link on a web page — the video opens in a standalone Windows Media Player window. This has its advantages, but unfortunately supporting your meticulously crafted closed captions is not one of those advantages.


The Windows Media Player will not automatically show your closed captions, which is indeed unfortunate. But even more problematic is that there is no obvious and easy way for the viewer to turn closed captioning on. So if you want your viewers to see those closed captions, they have to know how to enable them and since most people just don't know how to do that, you'll have to provide instructions.


To set Windows Media Player up to support your closed captioning, launch your video to open the player. In Windows Media Player, click the Now Playing drop-down list and choose More Options from the list. In Windows Media Player 12, press the Alt key and choose Tools | Options from the menu. In the Options dialog box, click the Security tab. Select the Show local captions when present checkbox as I have in Figure 2). And Finally, click OK.


Figure 2

Select the Show local captions when present checkbox.


Next, you need to access the Windows Media Player's traditional menus. To find them if you can't already see them, right-click the blank area next to the transport controls at the bottom of the window to access the menu shown in Figure 3.


Figure 3

Right-click the blank space next to the transport controls to access the "Classic Menus."


From the menu, choose Play | Lyrics, Captions, and Subtitles | On if Available. In Windows Media Player 12, press the Alt key to access this menu. Now, close the Windows Media Player. Finally, launch your WMV file again. Now as it plays, you see your closed captions below the video as in Figure 4 where you see my caption.


Figure 4

Once you've set everything properly, your captions appear beneath the video in the Windows Media Player.


So, success! Your viewers can now see your closed captions. Accomplishing the task with this standalone player method has the advantage of working with most browsers. But it has the clear disadvantage of forcing your viewer to jump through a lot of hoops and follow specific procedures in order to set their player up so they can see the captions. And any wrong step in the procedure will cause problems that will only serve to frustrate your viewers — obviously not something you want to happen!


So, is there a way around all of this work on the viewer side? Well, yes…sort of. The good news is that you can include the Windows Media Player as an object embedded into an HTML page, set that page up so that it automatically shows the captions, and thus take the setup burden we just talked about off of your viewer. The trade off is that the technique only works on specific browsers with Windows Media Player version 10 and higher.


However, there is a bit of a silver lining: This technique works with Internet Explorer on Windows, so it will probably work for a majority of viewers in general. If you happen to have a viewer base that uses other browsers (including Internet Explorer on the Mac), then this technique isn't going to work very well for you.


To embed a Windows Media Player window inside an HTML page, standard HTML dictates that you use the <embed> tag. Unfortunately, that tag doesn't support Windows Media Player closed captioning, which is why any browser that relies on that tag can't support closed captioning. On the other hand, Internet Explorer utilizes a non-standard tag to embed the player — the <object> tag. This tag does support closed captioning. This explains the mystery of why closed captions work in Windows Explorer and Netscape, but not Firefox or some other browsers.


Below I've included the HTML code that I'm using to make captions work in the example I'm working on as I write this article. You can copy and paste this code into your HTML page and then make a few changes so that it works with your WMV and SAMI files.


<object id="Player" classid="CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6" width="80%"
height="80%">
<param name="URL" value="Embedtest.wmv">
<param name="autoStart" value="True">
<param name="uimode" value="full">
<param name="captioningID" value="captions">
<param name="SAMIFileName" value="Embedtest.smi">
<PARAM name="ShowCaptioning" VALUE="True">
</object>
<div id="captions" style="background-color:black; width:80%; height:10%">
</div>


Notice that the various <param> tags give the browser the information it needs to both play the WMV file and include the closed captions. You will need to change the value parameters of some of these tags so that the code plays your video correctly. For instance, in the <param> tag that I've set the name attribute to “URL”, you'll have to change the value attribute to the name of your WMV file instead of the name of mine (Embedtest.wmv). You'll also have to change the value attribute for the “SAMIFileName” <param> tag to match the name of your SAMI file.


You can modify others of the tag attributes according to your preference. For instance, in the <object> tag itself, you can enter different values for the width and height attributes to size the player on your page. If you do change the size (particularly the width), you'll have to change the width attribute of the <div> tag to match it. The <div> tag controls the appearance of the captions area, so you'll want to make sure the width matches the width that you specify for the player.


If you don't want the video to play automatically, you can change the value attribute of the “autoStart” <param> tag to “False”.


In addition to these changes to the code in the HTML file, you can also change the contents of the SAMI file to further manipulate the appearance of your closed captions. To do this, open the SAMI file in a text editor. I use Notepad.


The SAMI file is written using cascading style sheets, so if you're familiar with how those work, you'll easily grasp the techniques for altering your captions. Here's the code for the SAMI file that I'm working with up through the second line of captions:


<SAMI>
<HEAD>
<SAMIParam>
Metrics {time:ms;}
Spec {MSFT:1.0;}
</SAMIParam>
<STYLE TYPE="text/css">
<!--
P {
font-size: 12 pt;
font-family: Arial;
font-weight: Regular;
color: #ff0000;
background: #000000;
text-align: Center;
padding-left: 5px;
padding-right: 5px;
padding-bottom: 2px;
}
#MyFont {Name: MyFont; color: yellow; margin-left: 30pt; margin-right: 30pt;}
.ENCC {Name: English; lang: en-US-CC; color: yellow; margin-left: 30pt;
margin-right: 30pt;}
-->
</STYLE>
</HEAD>
<BODY>

<SYNC Start="2544">
<P Class=ENCC ID=MyFont>Currently my license rating is that of a super-duper pilot;
instrument, so I do have my instrument rating.</P>
</SYNC>
<SYNC Start="6590">
<P Class=ENCC ID=MyFont>I received that also through the Morey airport in Middleton
through what they call their west-coast trip.</P>
</SYNC>


If for some reason you want to change the text of a caption, you can type something different within the <P> tag that surrounds the text you want to change. If you want to adjust the start time of the caption, change the value of the Start attribute of the corresponding <SYNC> tag. The Start attribute shows the time in frames, so if you want to add one second to the start time, add 30 to the current value (assuming you’re video uses a frame rate of 30 fps). For example, you can see that for some reason I placed my first caption marker pretty late in the video. In actuality, in my video, the man starts speaking immediately and my caption comes in considerably late. When I change the value of the Start attribute for this caption's <SYNC> tag to “100”, the caption comes in at a much better time.


You can also make adjustments to the property values listed under the P and #MyFont selectors in order to change the appearance of the text in your captions. For instance, use the font-size property of the P selector to change the size of your text. To change the color of the text, change the color parameter of the #MyFont selector.


Rather than take you through all of the possible changes you can make to this code, I'll leave it at these examples and encourage you to experiment on your own to see what you can do!


You should keep one final thing in mind before you decide to embed your Windows Media Player as I've described here: Embedding the Windows Media Player into a page can have detrimental effects on the accessibility of the player. Specifically, the keyboard and other assistive devices give little control over an embedded player and that will make it difficult for those who rely on such devices to assist them in their browsing and computer usage.


I understand that this may be a difficult topic for you if you have no experience with HTML or cascading style sheets, but hopefully you now at least understand the issues at play when it comes to incorporating closed captioning into your WMV files. Before you make that WMV file available for your viewers, you have a few decisions to make based on what we talked about here!


To find more training resources, visit us in the Training Zone at www.sonycreativesoftware.com/training. There you'll find all of our training offerings including books, our Seminar Series training DVDs, and lots of free tutorial videos and archived webinars.



Follow Us Online Facebook Twitter YouTube
Email Sign up:  Submit
  • Sony Creative Software inspires artistic expression with its award-winning line of products for digital video, music, DVD, and audio production.

    Sound Forge, ACID, and Vegas software have defined digital content creation for a generation of creative professionals, amateurs, and enthusiasts.

    © 2003-2014 Sony Creative Software, Inc. All Rights Reserved.
McAfee SECURE sites help keep you safe from identity theft, credit card fraud, spyware, spam, viruses and online scams
Sony.com