This project is read-only.

Automating Via a Console Application

If you would like to automate expression to combine media files via a console application, this is how you would do it with our little helper. Note, as has been said elsewhere, the utility that this uses is only for automating the splicing of a media resource (image or video) to the beginning or end (or both) of a .wmv.

This is a very early version of this code. It appears to work but your mileage may vary. Note that ALL it does is combine media files. That is the only automation at this point.

To do this...
  1. Create a console application.
  2. Then reference the ExpressionAutomation library in the source download for C4MVC.
  3. Call the MediaItemCombiner class as is exemplified below.

using System;
using Microsoft.Expression.Encoder;

namespace ExpressionAutomation.Console
    class Program
        static void Main(string[] args)
            string basePath = @"C:\Dev\PowershellFun\";
            string introPath = basePath + "FirstResource.jpg";
            string moviePath = basePath + "livemeeting_cut.wmv";
            string outroPath = basePath + "LastResource.jpg";
            string destinationPath = basePath;

            var combiner = new MediaItemCombiner();
            combiner.OnCombinerProgress += new EventHandler<EncodeProgressEventArgs>(combiner_OnCombinerProgress);
            combiner.Combine(moviePath, introPath, outroPath, destinationPath);

        static void combiner_OnCombinerProgress(object sender, EncodeProgressEventArgs e)

Expression Encoder will create a folder in your destination path folder that will include the newly encoded video.

Last edited Feb 10, 2010 at 5:19 AM by Mallioch, version 2


No comments yet.