Export (0) Print
Expand All

PowerShell sample

This sample shows how to encapsulate the Microsoft Expression Encoder batch-encoding capabilities in a PowerShell 2.0 Module.

Using the Expression Encoder object model, single or multiple files can be processed from the PowerShell command line. The sample supports encoding a job file saved by the Expression Encoder graphical user interface (GUI), applying one or more system presets as well as setting metadata fields and applying Microsoft Silverlight templates.

Requirements

To run this sample, you will need one of the following:

  • Windows 7 RC1.

  • Windows Vista.

  • Windows XP SP3 with Windows PowerShell V2 CTP3 installed. You can download PowerShell from the Microsoft Download Center Ff396032.xtlink_newWindow(en-us,Expression.30).png.

Compiling and installing the PowerShell module

If you had to download the PowerShell module, you will need to install it.

To compile and install the PowerShell module

  • From the EncoderPowerShellModule directory, open a command prompt and use the command msbuild. EncoderPowerShellModule.csproj to compile the project. This will install the Expression Encoder module in %HOMEPATH%\Documents\WindowsPowerShell\Modules.

Example scripts

Below are some example scripts that you can use to process media from the PowerShell command line. The sample file paths to media files may not represent actual paths to your media files. Make sure that you use file paths that are pertinent to your system.

Import the expressionencoder module

import-module expressionencoder

Perform a simple encode of a single file using VC-1 for Zune HD preset

sl $home\desktop
Convert-Media -Input 'C:\users\Public\Videos\Sample Videos\Bear.wmv' -VC1ZuneHD

Encode a single file with metadata specifying output directory

Convert-Media -Input 'C:\users\Public\Videos\Sample Videos\Bear.wmv' -Title "Cool" -Description "Long video" -VC1Archive -Output $home\desktop

Encode a single file with multiple presets, and multiple outputs

Convert-Media -Input 'C:\users\Public\Videos\Sample Videos\Bear.wmv' -VC1Archive -VC1HD1080pVBR -VC1ZuneHD -Output $home\desktop

Encode a single file to a Silverlight template

Convert-Media -Input 'C:\users\Public\Videos\Sample Videos\Bear.wmv' -VC1HighSpeedBroadbandVBR -TemplateSL3Standard -Output $home\desktop

Encode multiple files to a Silverlight template

gci 'C:\users\Public\Videos\Sample Videos' | Convert-Media -VC1IISSmoothStreamingSD480pVBR -TemplateBlackGlass -Output $home\desktop

Encode a jobfile saved by the Expression Encoder GUI

Convert-Media -jobfile "C:\Users\username\Desktop\joboverlay.xej"

   © 2010 Microsoft Corporation. All rights reserved.
Show:
© 2014 Microsoft