Delen via


What’s New in the Expression Encoder 3 SDK?

When Encoder 3 is installed we now install the API help file, intellisense files and the sample projects, so you’re ready to go with the SDK as soon as Encoder is installed. You will find a SDK link on the start menu that will take you to the folder from where you can find the samples (in C# and Visual Basic) and the help CHM file.

Live Encoding Support

I know a bunch of you have been waiting for this for a while now and you’ll be glad to see that V3 has full support for the Live mode of the application through the object model.

e.g.

 // Create a new LiveJob to begin broadcasting this file.
using (LiveJob job = new LiveJob())
{
    // Create a new file source from the file name we were passed in
   LiveFileSource fileSource = job.AddFileSource(@"C:\myvideo.wmv");

    // Set this source to Loop when finished
   fileSource.PlaybackMode = FileSourcePlaybackMode.Loop;

    // Make this source the active one
   job.ActivateSource(fileSource);
…

From the LiveJob object you can get a list of video and audio capture devices installed on the system and add them as sources as well. See the Microsoft.Expression.Encoder.Live namespace for further details and the new Live SDK sample that is installed.

Redesigned profile support with full support for H.264 customization.

In V3 we now have separate profile classes for each profile type. This way if you’re dealing with the Main H.264 video profile for instance you’ll just see the properties that pertain to that profile on the object. (Note that you need the full version of Encoder for H.264 support). Along with this you now specify the profiles within the OutputFormat property on the MediaItem.

Bitrate is specified by using one of the new bitrate classes, ConstantBitrate, VariableConstrainedBitrate, VariableUnconstrainedBitrate and VariableQualityBitrate. Again this is so that only the properties that make sense are exposed on the class. For example when using VariableConstrainedBitrate there is a PeakBitrate property but that property isn’t exposed on any of the other bitrate classes as it only applies to the variable constrained bitrate type.

e.g.

 MainVC1VideoProfile videoProfile = new MainVC1VideoProfile();
videoProfile.Bitrate = new ConstantBitrate(350);
videoProfile.Complexity = VideoComplexity.Fastest;
videoProfile.Size = new System.Drawing.Size(640, 480);

MediaItem item = new MediaItem(@"C:\myvideo.wmv");
item.OutputFormat = new WindowsMediaOutputFormat()
{
    VideoProfile = videoProfile
};

Smooth Streaming

The Encoder SDK supports encoding to the smooth streaming output format (when using the full version of Expression Encoder). The video profile class now has a streams property which is used to specify the details of each stream that you wish to encode. Smooth Streaming can be used when encoding to constant bitrate for VC-1 and H.264 and to variable constrained bitrate when using VC-1. Additionally when using VC-1 and variable constrained bitrate you can specify that the sizes of the streams should be automatically determined by the encoder based upon the content and the bitrate. In this case you specify the maximum width and height to use for each stream.

e.g.

 AdvancedVC1VideoProfile videoProfile = new AdvancedVC1VideoProfile();

// When you create a VideoProfile you'll get one stream by default.
// In this example remove that one as we’re going to explicity 
// add the three streams below.
videoProfile.Streams.RemoveAt(0);
videoProfile.Streams.Add(
    new VariableConstrainedBitrate(1450, 1600),
    new System.Drawing.Size(800, 600));
videoProfile.Streams.Add(
    new VariableConstrainedBitrate(1050, 1600),
    new System.Drawing.Size(640, 480));
videoProfile.Streams.Add(
    new VariableConstrainedBitrate(600, 1600),
    new System.Drawing.Size(400, 300));

// Use smooth streaming with automatically sized streams.
videoProfile.SmoothStreaming = true;
videoProfile.Streams.AutoSize = true;

Encoding Multiple Sources Together

In V2 you could essentially combine up to three sources by using the leader, main video and trailer. In V3 you can move past this limit and combine multiple sources into one by using the new Source class.

e.g.

 MediaItem item = new MediaItem("mymovie1.wmv");
item.Sources.Add(new Source("mymovie2.wmv"));
item.Sources.Add(new Source("mymovie3.avi"));
item.Sources.Add(new Source("mymovie4.wmv"));

File Information

There are new classes to help analyze an existing media file to determine information about its video streams and audio streams (in case the file has more than one).

e.g.

 AudioVideoFile source = new AudioVideoFile("myvideo.wmv");
Console.WriteLine(source.VideoStreams[0].VideoSize);
Console.WriteLine(source.VideoStreams[0].AspectRatio);
Console.WriteLine(source.VideoStreams[0].Duration);
Console.WriteLine(source.AudioStreams[0].Channels);
Console.WriteLine(source.AudioStreams[0].SampleSize);

If the source file does have more than one audio stream you can now specify which stream is used when encoding by setting the AudioStreamIndex property on the Source object.

e.g.

 item.Sources[0].AudioStreamIndex = 2;

Presets

For all the standard presets that are installed with the application we have specified pre-defined static instances for each one to make it easier to use in case you don’t want to set all the properties of the profiles individually.

e.g.

 mediaItem.ApplyPreset(Presets.VC1HighSpeedBroadbandVBR);

If you look at the Presets Members in the SDK help file you’ll see all the options along with descriptions.

So there you have a quick introduction to some of the new changes and improvements to the Expression Encoder object model in version 3. You can check out the What’s New section in the SDK help file for further details and feel free to give us your feedback and ask questions either by adding a comment here or over in the Expression Encoder Forum

Comments

  • Anonymous
    July 30, 2009
    Hello nice post, i started this week working with encoder 3. My goal is to live feed from my canon hv30 that plugs to my pc by firewire. I m not able to use in HDV format only in DV with the Encoder v3.0. Is it possible to go around this with the sdk ? Thank you in advance Rui Marinho

  • Anonymous
    July 30, 2009
    Sorry we have more work to do, to support HDV devices. Regards Dean.

  • Anonymous
    July 31, 2009
    I have seen some examples of sdk about encoding using source file such as MediaItem(@"C:UsersPublicVideosSample VideosBear.wmv"). I am interested to do screen capture with SDK, similar to the utility "Screen Capture" comes with the EE3, any sdk examples? Thanks!

  • Anonymous
    August 06, 2009
    Will you please clarify your support of the H.264 implementation like http://en.wikipedia.org/wiki/H.264#Software_encoder_feature_comparison? Does it support CABAC and full main profile?

  • Anonymous
    August 07, 2009
    The comment has been removed

  • Anonymous
    August 10, 2009
    hi, i use expression encoder 3 but my video encoding failed it gives me error msg "the audio profile settings do not match valid system profile" my os is window 2003 x86

  • Anonymous
    August 18, 2009
    Encoder doess support main profile and CABAC. Regards Dean.

  • Anonymous
    August 18, 2009
    There is a Live sample which should hopefully get you started. Regards Dean.

  • Anonymous
    August 18, 2009
    Windows Server 2003 doesn't support Wma Professional so you'll need to change the audio codec to regular Wma. Regards Dean.

  • Anonymous
    August 22, 2009
    The comment has been removed

  • Anonymous
    September 02, 2009
    Hi if me as MSDN subscriber get this SDK could I just make software using this SDK and sell it? my client needs to buy the license to use my software? regards

  • Anonymous
    September 03, 2009
    Does version 3 of the Encoder SDK support Screen Capture?

  • Anonymous
    September 22, 2009
    What happened to the  Silverlight Streaming Publishing Plug-in for Expression Encoder 2? It appears that the link has been removed. Can anyone post it or send it to me? Thanks!

  • Anonymous
    September 24, 2009
    Can I use the Encoder 3 SDK with asp.net so that I capture the screen and broadcast it live on my asp.net website? Thanks

  • Anonymous
    November 10, 2009
    Hi, is now possible, using expression Encoder 3 SDK, to capture and manipulate a streaming signal (for example from some decoder)? I'm working on a big business application and have to develop some procedure that swithces from a file source to streaming signal source......Is it now possible? thanks!

  • Anonymous
    January 12, 2010
    i use expression encode sdk api from c#, in x86 server run excelent, but in x64 not work... I was reading about x64, ws2003 x64 etc..  incompatibility ... my scenarios is pc develop windows 7 (x86), server windows server 2008 r2 (of course x64)... I installed (on my server 2008 r2) expression studio (encoder packet only) for verify if its work... and all working ok.. my question, how i can use expression encoder api from .net over x64 plataform ? thanks, PD: sorry for my english i speek spanish

  • Anonymous
    January 20, 2010
    How can i feed bitmap and generate WMV file. Please anyone reply me the proper class and the member function to do so. I

  • Anonymous
    March 14, 2010
    Does anybody know how I can create manifest files using SDK? Encode() does not create these or Setting.dat file.

  • Anonymous
    August 24, 2010
    Apparently you still cannot combine a wmv with no audio with a wma?! If the wmv HAS audio you can replace it with audio overlay. If it doesn't, audio overlay is inaccessible. It would seem NOT having audio in a wmv is the most logical reason to WANT to overlay/combine with a separate wma. Why is it not possible?

  • Anonymous
    October 07, 2011
    The first comment: "Hello nice post, i started this week working with encoder 3. My goal is to live feed from my canon hv30 that plugs to my pc by firewire. I m not able to use in HDV format only in DV with the Encoder v3.0. Is it possible to go around this with the sdk ?" Is this possible now?

  • Anonymous
    November 25, 2013
    I cannot install the Expression Encoder 4 free sp2 on Windows XP. I can see the licensing agreement, but no buttons appear to accept or decline. Any ideas?