A month ago, Microsoft published the alpha version of the IIS Transform Manager. The Transform Manager provides simple integrated video encoding and batch conversion of video files to the IIS Smooth Streaming format.¬† It does this quite nicely, as it provides an extensible platform for scheduling and running multiple tasks in sequence on an IIS server using a local task scheduler. It enables “watch folder” job submission, queuing, management, integrated media transcoding/transmuxing, and batch-encryption of on-demand audio and video files. You can get more information from here, here and here.
My friend John Deutscher is leading these efforts. John has a lot of experience with media management software and a passion to make developers lives’ easier. He was also one of the masterminds behind the Rough Cut Editor (RCE), a lightweight, Web-based Silverlight video editing tool. As a client tool, it submits edit decision lists, but does not include the logic for transcoding. But it’s highly extensible, and from time-to-time, we’ve been asked about extending the tool to add an encoding workflow process.
The real question here is whether the RCE should take care of that. Instead, Why not take advantage of the tools available out there and use them to manage the complexity of the encoding process?
This post is result of exploring the feasibility of using the IIS Transform Manager to take an RCE Project XML file (which includes the EDL) as input, and creating the necessary task to output a new encoded video that represents the RCE edits?
So with that goal in mind, I started to build a proof of concept of the scenario, depicted in the following diagram:
PoC Diagram – (icons from picol.org)
- Internet Information Services (IIS) 7 or higher
- Microsoft .NET Framework 3.5 Service Pack 1
- Microsoft .NET Framework 4 (required for use with Expression Encoder 4.0)
- Silverlight Runtime
- IIS Transform Manager 1.0 (Alpha)
- Microsoft Silverlight Rough Cut Editor configured to use the File System Data Provider (check the related topic on the RCE documentation)
- Microsoft Expression Encoder 4 Trial or Pro
- Sample videos (required for use with the RCE and the File System Data Provider)
OK. Let’s assume we have all the ingredients in place and that we are ready to start.
The first thing to do is to create the Transform Manager Task. This task will parse the RCE Project XML, extract the edits metadata and use that information with the Expression Encoder 4 API to perform the encoding.
I will not copy all the code for the Task in the post (you can download that from here. Make sure to include into the libs folder the EE4 and IIS Transform Manager assemblies in order to build the project), but instead let me highlight a few things:
- To create a custom Task for the IIS Transform Manager you must implement the ITransformTask interface (Microsoft.Web.Media.TransformManager.Sdk.dll)
- Once you have created the task, you must create a task definition xml file (the task definition schema can be found here).
The following is the Task Definition for the RCE Project task:
<taskDefinition xmlns=“http://schemas.microsoft.com/iis/media/v4/TM/TaskDefinition#“> <name>RCE Project Task</name> <id>7F8A89DA-1DF9-409A-9869-A5CDCA017998</id> <properties namespace=“http://schemas.microsoft.com/RCE/V1#” prefix=“rce“> <property name=“preset” value=“” /> </properties> <description xml:lang=“en“>Invokes Expression Encoder 4 to produce a video based on the edits metadata defined on an RCE Project File</description> <inputDirectory></inputDirectory> <outputDirectory>RCEProjectTaskOutput</outputDirectory> <taskCode> <type architecture=“x86” >RCE.TransformManager.Tasks.RCEProjectTask, RCE.TransformManager.Tasks, Version=184.108.40.206, Culture=neutral, PublicKeyToken=null</type> </taskCode> </taskDefinition> ¬
As you can see, it defines a property called preset, which is intended to be used to provide the Expression Encoder 4 preset.
– The input directory points to the directory where the source videos are located (which is the same directory used on the RCE File System Data Provider configuration)
– The output directory will be later used by an XCopy task defined on the Job Template that will copy the resulting files back to the source videos directory (making the resulting video available to the RCE)
- Register the task with the IIS Transform Manager. A great tutorial on how to do custom task registration can be found here, but it basically involves two steps:- Copy the custom task assembly to C:Program FilesIISTransform Manager (on a x86 computer) or to to C:Program Files (x86)IISTransform Manager (on a x64 computer)
– Copy the custom task definition XML file to the %ProgramData%MicrosoftIISTransform ManagerConfigurationTask Definitions directory
Once you have your Transform Manager task ready and configured, launch the Internet Information Services and configure the IIS Transform Manager.
First, stop and start the IIS Transform Manager service so it can detect the new task, then follow these steps to create a job template.
- Create a New Job Template (Transform Manager > Job Templates > New) and fill the Name field.
- Click Add to launch the Add Task dialog.
- Select the RCE Project Task and the XCopy Task and click OK.
- Make sure that the task definitions list shows the RCE Project task on top of the XCopy task (use the Move Up / Move Down buttons to adjust it)
- Select the RCE Project Task and click Edit.
- Fill the input directory field and the preset property. Click OK to save.Note: I’m using one of the predefined presets of EE4 (VC1-ScreenEncoding VBR for Silverlight), but you can use any you prefer.
- Select the XCopy task and click Edit.
- Fill the fields as described below. Click OK to save.
- Click OK to save the job template.
Now it is time to add the Watch Folder. For the sake of simplicity, in the PoC, I will use the folder where the RCE exports the project output. This folder is located at
|Note: For this PoC, I’m running all the components (RCE, IIS Transform Manager, Expression Encoder 4) in the same computer, which is unlikely for a production environment, but makes it easy to develop on a single machine.|
- Create a new watch folder (Transform Manager > Watch Folders > New)
- Fill the watch folder settings:
- Click OK to save the watch folder.
- Finally, select the watch folder and click Enable and then click Start. This will leave the watch folder ready to use.
Great!. Everything is cooked. Let’s see how it tastes.
- Launch the RCE and perform a couple of edits. I’ve four videos on my library and I created an edit of around 1 minutes and 56 seconds using two of those videos.
- Select the Output Tab, and click Export to export the RCE project.
- Open the IIS and go to the Job Monitor option of the IIS Transform Manager. You will see that your job is running!!
- Once the encoding is completed, the second task of the job is going to be executed, copying the new file on the folder you configured.
- Refresh the RCE (press F5), and you’ll see a new video on the library, with the exact same duration of the edit you created.
We just proved that the RCE and the IIS Transform Manager can easily work together. The IIS Transform Manager’s extensibility allowed us to create a simple task to integrate the RCE export process with it and to output a new encoded video that represents the RCE edits. And this is just the beginning…
Hope this helps,
THE CODE AND THIS POSTING IS PROVIDED “AS IS” WITH NO WARRANTIES, AND CONFERS NO RIGHTS.