Encoding Video using Expression Encoder 4.0 and using it in an ASP.NET Website
Posted by: Suprotim Agarwal
in Category Silverlight 2, 3, 4 and 5
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 -
Now let's open Microsoft Expression Encoder 4.0 and choose 'Silverlight Project' as shown below-
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 -
Once you import the video, your screen should look similar to the following -
Now let's take an overview of the items we will be using for our demonstration -
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 -
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 -
Now add a couple of Markers in the video after some intervals. Your Marker window will look like this after adding all the markers -
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 -
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 -
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 -
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 -
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 -
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
This article has been editorially reviewed by Suprotim Agarwal.
C# and .NET have been around for a very long time, but their constant growth means there’s always more to learn.
We at DotNetCurry are very excited to announce The Absolutely Awesome Book on C# and .NET. This is a 500 pages concise technical eBook available in PDF, ePub (iPad), and Mobi (Kindle).
Organized around concepts, this Book aims to provide a concise, yet solid foundation in C# and .NET, covering C# 6.0, C# 7.0 and .NET Core, with chapters on the latest .NET Core 3.0, .NET Standard and C# 8.0 (final release) too. Use these concepts to deepen your existing knowledge of C# and .NET, to have a solid grasp of the latest in C# and .NET OR to crack your next .NET Interview.
Click here to Explore the Table of Contents or Download Sample Chapters!