Encoding Video using Expression Encoder 4.0 and using it in an ASP.NET Website

Posted by: Suprotim Agarwal , on 11/30/2011, in Category Silverlight 2, 3, 4 and 5
Views: 77052
Abstract: In this article we will see how to encode video files and add Markers and Thumbnails using Microsoft Expression Encoder 4.0. After encoding the media, we will use it an ASP.NET web site.

In this article we will see how to encode video files and add Markers and Thumbnails using Microsoft Expression Encoder 4.0. After encoding the media, we will use it an ASP.NET web site.  Microsoft Expression Encoder replaces Windows Media Encoder and simplifies publishing video to Microsoft Silverlight.

The first step is to create an ASP.NET web site. To create a ASP.NET web site, open Visual Studio 2010. Click on File > New > Web Site. Choose 'ASP.NET Web Site' and call it 'ExpressionEncoderDemo' as shown below -

asp.net website

Now let's open Microsoft Expression Encoder 4.0 and choose 'Silverlight Project' as shown below-

Microsoft Expression Encoder 4

Once you create a 'Silverlight Project', let's import a video file which you want to encode. For this demonstration, I am importing a video file called 'Lake.wmv' from my local drive. To import the file, go to the File menu and click on import as shown below -

Import Video File

Once you import the video, your screen should look similar to the following -

clip_image008

Now let's take an overview of the items we will be using for our demonstration -

Expression Encoder Slider

1) First Part is the Slider - Using this Slider, you can capture different frames of the video.

2) Second Part is highlighted with a yellow border – This is used for going to the Previous or Next Edit or Marker. You can go to Next or Previous frame or you can even Play/Pause the video.

3) Third part is highlighted with red borders – This is used to insert the video at the beginning or end of the main video.

Now go to the Window Menu and click on the 'Metadata' and 'Output' menu. Both the window will look like the following -

Metadata and Output Window

The Metadata window is used to add the markers with the Thumbnails and Output window is used to store the completed encoding with thumbnails. In the Output window, choose a Custom radio button to add custom thumbnails. Also change the image format from jpeg to png and check the checkbox to Embed Thumbnail.

Now let's start by adding few markers in our 'Lake' video. To add a marker, we first need to move the slider (Orange Color) to a particular time and then click the (+) button shown in above image. Check the checkbox called Thumbnail and name the marker as 'Chapt1' as shown below -

Markers

Now add a couple of Markers in the video after some intervals. Your Marker window will look like this after adding all the markers -

Marker Window

After this, you have to change the Media template. The reason is thumbnails are available only with a few templates. So go to the 'Template' window and choose the 'Black Glass' template as shown below -

Black Glass Template

Now you will have to encode the video. In the 'Sources' window, right click the video and click on 'Encode Selected Item' as shown below -

Encode Selected Item

Save your job. Now go to the location where the encoded video is available. The default path on my machine is 'C:\Users\Admin\Documents\Expression\Expression Encoder\Output'.

This is how your output will look like -

clip_image022

Open the folder and you will see all the Thumbnails, Video, .XAP files and a html page 'Default.html'. Now let's copy all the files and go to our web site 'ExpressionEncoderDemo'. Add a new folder under the web site with the name 'EncoderDemo'. Paste all the files under that folder.

Now browse the 'Default.html' page and click on the Start button as shown below -

Start Button

Once you start the Media Player, you will see a button 'Toggle Chapter List'. Click the button and you will see the Thumbnails (depending on the markers) on the top -

Expression Encoder Thumbnails

Now by selecting any of the chapters, you can play the video from that time interval.

Summary - In this tutorial we have seen how to encode a video file, add markers and thumbnails using Microsoft Expression Encoder 4.0 and embed the same in our ASP.NET web site.

The entire source code of this article can be downloaded over here

Give a +1 to this article if you think it was well written. Thanks!
Recommended Articles
Suprotim Agarwal, ASP.NET Architecture MVP, MCSD, MCAD, MCDBA, MCSE, is the CEO of A2Z Knowledge Visuals Pvt. He primarily works as an Architect Consultant and provides consultancy on how to design and develop .NET centric database solutions.

Suprotim is the founder and primary contributor to DotNetCurry, DNC .NET Magazine, SQLServerCurry and DevCurry. He has also written an EBook 51 Recipes using jQuery with ASP.NET Controls. and is authoring another one at The Absolutely Awesome jQuery CookBook.

Follow him on twitter @suprotimagarwal


Page copy protected against web site content infringement by Copyscape


User Feedback
Comment posted by XshivDev on Monday, March 4, 2013 12:25 AM
But it showing that the video can be downloaded easily, and i need to make it hidden that is why i am using the encoder, will you please help me to make the video hidden(that's mean cant download) and how to place in my asp.net website..
Thanks in advance


Post your comment
Name:  
E-mail: (Will not be displayed)
Comment:
Insert Cancel