If you have a critical encoder streaming live audio for an Internet radio station or maybe video for a presentation then you want that encoder to be running all the time and you shouldn't have to login and restart the encoder manually if the host computer loses power or reboots. The Windows Media Encoder has a wonderfully simple graphical user interface but unfortunately you cannot directly configure it as a service to run in the background when the host starts up. Fortunately Microsoft provides a command line script that you can use to start an encoding session on boot-up.
Requirements:
- Windows 98, ME, NT, 2000, 2003, XP
- Windows Media Encoder (preferably version 9) Download
- Windows Media Encoder Series SDK (preferably version 9) Download
- Windows Media Encoder Session File (*.WME) configured for your stream
Setup:
- Download and install the WME Series SDK somewhere on your computer.
- Create a convenient folder to store your files on your hard drive, I recommend “C:\WME”
- Open the SDK folder and find the file called “Wmcmd.vbs”. If you installed in the default path it will be under “C:\WMSDK\WMEncSDK9\samples\vb\wmcmd” Copy this file to your new WME folder.
- Create your Session file using the WME graphical interface and save it to your WME folder.
- Open Notepad (under Programs | Accessories) and enter a line such as the following, substituting the correct file names and paths:
cscript.exe path_to_wmcmd.vbs -wme path_to_session_file
For example:
cscript.exe C:\WME\wmcmd.vbs -wme C:\wme\stream1.wme
Note: for Win 98 and ME you may get away without the preceeding "cscript.exe" or you can try just "script.exe"
- Save the file with the .BAT extension. The easiest way to do this is to put quotation marks around the file name in the Notepad dialog box. For example type “encode.bat” with the quotes.
- Test the new .BAT file by finding it with My Computer or Explorer and double clicking it. A black DOS box should open and periods (.) should start to appear as encoding progresses. Check to make sure you can access your stream.
Now there are two ways to make your .BAT file start automatically without anyone having to logon.