How to Auto Start Expression Encoder v4 Sample provided

Several people have wanted to automate this functionality with the Expression Encoder and there is really not a sample avaliable in the SDK to accomplish this task. as such thanks to my colleague Mahatab Ur Rashid for his valuable input on creating the sample demonstrated here.

This programming sample is provided As – is for illustration only, without warranty either expressed or implied. The sample assumes that you are familiar with the programming language being demonstrated and the tools used to create and debug procedures.

Review the figures below then download the code sample below.  You can import the solution into your  Microsoft Visual Studio 2010 project, build the project, to modify and work with the sample code provided.

Application to restart encoding Session if there any errors while encoding (

This Expression Encoder 4 SDK based application can start/stop an encoder job from a job file. It can trap and display user and encoder events (including errors) realtime. If there any encoder errors stop the encoding process then it restarts the encoding automatically. This tool also can save all the events in a file for further troubleshooting.


How to use:

·         Steps to start an encoding process:

1.       Run the EE4Restart.exe

2.       Enter the Job file name with path into the text box.

3.       Click on the “Start” button to start encoding. You will see all the status messages in the status message window.

 ·         Saving status messages in a log file:

Go to “File” menu and select “Save”. The log file will be saved in the temporary directory of the system.


Download the following file to review or build the sample:


Comments (6)

  1. Helen says:

    Hi, seems the zip file is not available for downloading.

  2. TrickyDix says:

    Hi Helen,

    Thanks for noticing, the download should be avaliable at this time.

  3. Helen says:

    Thanks a lot! Downloaded. Still have several question (hope you know):

    1. How to set the archive file, as in Window Media Encoder 9: WMEncoder.File.LocalFileName

    2. What functions to call to automate archiving, as what WMEncoder.Archive does?

    Many thanks!

  4. Jake says:

    Hi, thanks for posting your application. I seem to have an issue trying to get it working and I wondered if you might have an idea as to why I am having this issue.

    I have a Live Job file that i created with Expression Encoder 4. I am using a file on my hard drive for the source and I have it setup to loop. I have setup the live job to push the stream to a publishing point. This works just fine through the Expression Encoder 4 GUI. However, when I try to use your program the program hangs on the job.StartEncoding and the last event logged into the program is User: Trying to start encoding.

    I cannot figure it out. The same exact live job file works fine with the EE4 GUI but not with your program or with the code I put together using the SDK.

    If you could help shed some light as to what could be happening that'd be great!

  5. Jonathan says:

    Thanks for this useful tool. Is it possible to script the launch of the AutoRestart app, building in the location of the .XEJ file? Something like a simple BAT file with "c:pathtorestart.exe c:path]tofile.XEJ" so I can add it to the Startup folder and have a hands-off encoder restart in the case of a system crash?


  6. Dimitri says:

    I know this is old but anyone ever figure out how to have a job run automatically on pc startup?