Previous | Next |
All the files needed for this sample are copied to your computer when the Windows Media Technologies SDK is installed. To use the Encoder Scripting Utility Sample, run Setup.exe to install it on your computer, then open the Encoder Scripting Utility from the Start menu. The default installation path to the Encoder Scripting Utility Sample setup program is C:\Program Files\Windows Media Components\SDK\Samples\WMEScript\Setup.exe.
To set up the Encoder Scripting Utility Sample
Creating the .asd File
To start encoding using the Encoder Scripting Utility Sample, you must import an existing ASF Stream Descriptor (.asd) file. Without an .asd file, the Encoder Scripting Utility Sample cannot configure and control the Encoder object. If a properly configured .asd file does not already exist, you must create one by using Windows Media Encoder.
Open Windows Media Encoder, enter custom settings for encoding from a live source, and then save the settings as an .asd file. On the Capture Source screen of the custom settings wizard, select the Script Commands check box. Script commands are not available using the QuickStart or Template with I/O options wizards. For more information about creating .asd files, see Using Windows Media Encoder in the Windows Media Tools documentation.
Running the Sample
After you have successfully created an .asd file, close Windows Media Encoder, and run the Encoder Scripting Utility: in the Start menu, point to Windows Media, and click Encoder Scripting Utility. Load the .asd file, and click Start Encoding. You can enter script commands one at a time in the Type and Command boxes, or import a script command file that contains a list of commands. To send a script command, enter the command in the Type and Command boxes, and then click Send. You can click a type string in the Type list, or enter one of your own.
Creating a Script Command File
To use a list of script commands in the Encoder Scripting Utility Sample, create a script command file, and then open the file in the utility. A script command file is a text file that you can create using a basic text editor, such as Microsoft® Notepad. For the utility to properly parse the file, text must be formatted using the following guidelines:
The following sample text shows the proper formatting:
; Comments can be added after a semicolon on a new line.
FILE, c:\samplefile.txt
URL, http://www.microsoft.com/windows/
URL, http://servername/url&&sampleframe
TEXT, Sample text
CAPTION, Sample Caption
Save the file with a .txt extension, and then open it in the Encoder Scripting Utility Sample. A sample script command file, Sample.txt, is included in the WMEScript subdirectory.
Scheduling Encoding
The Encoder Scripting Utility Sample provides a way to schedule when encoding starts and stops. Click the Schedule Encoding icon on the toolbar, and the schedule dialog box opens. Use this dialog box to enter start and stop times, and the path to the .asd file that you want the utility to use for encoding. The utility sample must be running for the scheduling feature to work.
Using the Script Command Monitor
While encoding live over a network, you can monitor playback of the audio and video content, and the script commands by using the script command monitor Web page. Open Default.htm in the WMEScript directory, enter the URL of the live stream, and then click Connect. When a script command is received by Windows Media Player embedded in the Web page, code parses the script command strings using the type string, and displays the associated command string in the appropriate text box.
See Also
Encoder Scripting Utility Sample, Windows Media Technologies Solutions Samples
Previous | Next |