Expression > Forums Home > Expression Studio Forums > Expression Encoder > EE3 SDK Specify an audio profile
Ask a questionAsk a question
 

Proposed AnswerEE3 SDK Specify an audio profile

  • Thursday, October 29, 2009 3:15 PMDJMiller Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    I can't seem to customize the audio profile for a live encoding session.  Here's a snippet of my code.  How can I enumerate the video and audio profiles like I could with the WM9 encoder?

     

    Dim vidProfile As New MainVC1VideoProfile

    vidProfile.Bitrate =

    New ConstantBitrate(100)

    vidProfile.Complexity = VideoComplexity.Best

    vidProfile.Size =

    New System.Drawing.Size(320, 240)

     

    Dim audProfile As New WmaAudioProfile

    audProfile.Bitrate =

    New ConstantBitrate(20)

    audProfile.Channels = 2

    audProfile.Codec = AudioCodec.Wma

     

     

    'Set the output to broadcast and set the port

     

    Dim output As New WindowsMediaBroadcastOutputFormat

    output.BroadcastPort = 8082

    output.VideoProfile = vidProfile

    output.AudioProfile = audProfile

    job.OutputFormat = output

    job.StartEncoding()

All Replies

  • Thursday, October 29, 2009 5:11 PMDean RoweMSFTUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Proposed AnswerHas Code
    The video profiles can use pretty much whatever settings you choose. The audio profiles need to match one of the ones found on the system. You can enumerate those with code something like the following.

    foreach (AudioProfile audioProfile in 
        LocalProfiles.AudioProfiles)
    {
        // Code to look at each audioProfile 
        // to decide which one you want.
        ...
    }
    
    Hope that helps.
    Regards
    Dean.
    • Edited byDean RoweMSFTThursday, October 29, 2009 5:12 PMFix code formatting
    • Proposed As Answer byDean RoweMSFTThursday, October 29, 2009 5:13 PM
    •  
  • Thursday, October 29, 2009 5:24 PMDJMiller Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Thanks for the reply.  What namespace is LocalProfiles located in?  VS doesn't recognize it.  Once I have this, I'll post the resulting code to help others.  The SDK doesn't have much about devices or profiles in the examples.

    Dwight
  • Thursday, October 29, 2009 5:32 PMDJMiller Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    The SDK says its in Microsoft.Expression.Encoder.Profiles, but even after I import that namespace, VB doesn't recognize it.  Here's the code snippet.

    Imports

     

    Microsoft.Expression.Encoder.Profiles

     

    For Each aProfile As AudioProfile In localprofiles.audioprofiles

     

    Next

    VS says that localprofiles is not declared.  If I need to declare an object, what is its type?  I'm so close!
  • Thursday, October 29, 2009 5:38 PMDJMiller Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Another note, I'm using the free version of EE3, if that makes a difference.
  • Thursday, October 29, 2009 6:09 PMDJMiller Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    I had to add a reference to microsoft.expression.encoder.Api2 to my project.  Now I can enumerate the collection.  Now I can't seem to find out much about each profile.  My computer says I have 395.  There's no Name property or anything that helps identifiy the profile.  I even tried to MessageBox the bitrate and it doesn't return a number.
  • Thursday, October 29, 2009 6:53 PMDJMiller Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    My live encoding from a device is till not working.  I have a Pinnacle TV tuner card that I'm using for my live device.  Below is my code for my button click event.  I declare job as LiveJob at the class level.  Any ideas?  I can accomplish this task with the WM9 Encoder.  It this new encoder ready for prime time yet?

    Private

     

    Sub btnGet_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnGet.Click

    job =

    New LiveJob

     

    Dim videoDevice As LiveDevice = job.VideoDevices.Item(0)

     

    Dim audioDevice As LiveDevice = job.AudioDevices.Item(1) 'The tuner card is the second audio device.

     

    Dim liveSource As LiveDeviceSource = job.AddDeviceSource(videoDevice, audioDevice)

    liveSource.PreviewWindow =

    New PreviewWindow(New HandleRef(Panel, Panel.Handle))

    job.ActivateSource(liveSource)

    job.MuteAudioOutput =

    False

     

     

    Dim vidProfile As New MainVC1VideoProfile

    vidProfile.Bitrate =

    New ConstantBitrate(300)

    vidProfile.Complexity = VideoComplexity.Best

    vidProfile.Size =

    New System.Drawing.Size(320, 240)

     

    Dim mProfiles As AudioProfileCollection = LocalProfiles.AudioProfiles

     

    'Set the output to broadcast and set the port

     

    Dim output As New WindowsMediaBroadcastOutputFormat

    output.BroadcastPort = 8082

    output.VideoProfile = vidProfile

    output.AudioProfile = mProfiles.Item(0)

    job.OutputFormat = output

    job.StartEncoding()

     

     

    End Sub

  • Thursday, October 29, 2009 8:11 PMDean RoweMSFTUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Has Code
    There are different types of bitrate classes now.

    ConstantBitrate for CBR content which does have a bitrate value.
    VariableConstrainedBitrate for VBR constrained content which has an average bitrate as well as a peak bitrate.
    VariableUnconstrainedBitrate for VBR unconstrained content which just has the average bitrate and
    VariableQualityBitrate which had a Quality value instead of a bitrate in Kbps.

    It sounds like you may just want to apply one of the existing system presets. You can enumerate them with something like

    foreach (Preset preset in Preset.SystemLivePresets)
    {
        Debug.WriteLine(preset.Name);
    }
    
    alternatively if you know the name you can get it directly with something like

    Preset result = Preset.FindPreset("* Name of Preset *");
    
    Once you have the preset you want you can apply it to the live job.

    LiveJob job;
    Preset preset;
    ... // Initialize job and preset
    job.ApplyPreset(preset);
    
    Hope that helps. If you're still having problems with your can you tell me where it's failing, are you getting an exception thrown?
    Regards
    Dean.
  • Friday, October 30, 2009 1:35 PMDJMiller Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     

    In VB, I don't see presets.systemlivepresets.  Under presets.  it has specific presets.  It's not a collection that enumerates.  I'm using version 3.  I'll try one of these and see what happens.  My problem is that I'm not getting any audio with my video.  I just get a video stream.

  • Friday, October 30, 2009 1:41 PMDJMiller Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    When I use one of the presets, I get an Xml unhandled exception.  Cannot find element LivePreset in xmlfile at 3,2.

    Do you have an example of a live job using a hardware device that works?  I might be able to find my problem if I can see a working example.
  • Friday, October 30, 2009 2:49 PMDJMiller Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Here's something interesting.  I tested a live encoding session using Expression 3 (the application) using two different hardware devices and I don't get audio with either one.  I appears that there's a problem with  EE3 and live encoding with hardware devices.  One device is a TV tuner card and the other is a Dazzle firewire device seen by the system as a Microsoft VCR device.
  • Friday, October 30, 2009 7:14 PMDean RoweMSFTUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    You should find it under Preset (not Presets)
    Regards
    Dean.
  • Friday, October 30, 2009 7:15 PMDean RoweMSFTUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    That sounds like you've found a preset that is used in the offine portion of the app. You need to make sure you're pointing to a live preset.
    Regards
    Dean.
  • Friday, October 30, 2009 7:16 PMDean RoweMSFTUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    What is the make of your TV tuner card? I'll check if our test team has used that one before. Do you also have a model number for the Dazzle device?
    Regards
    Dean.
  • Monday, November 02, 2009 3:35 PMDJMiller Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     

    My TV card is a Pinnacle PC TV USB2 and the Dazzle is a Hollywood DV Bridge.  I can work with both devices using WM Encoder 9, but not with EE3 using the application or the SDK. 

    My company has an extensive distance learning application that we are considering re-writing in .net and I wanted to move to EE3 instead of WM9, but I'm having difficulty getting the SDK working.

    Is there anywhere I can see some more extensive code for working with Live Devices and not just a simple live encoding from a file like in the SDK documentation?

  • Monday, November 02, 2009 4:05 PMDJMiller Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Ok, now I can enumerate the presets by using the following code.

    cboVdeoProfile.Items.Clear()

     

    For Each Pset As Preset In Preset.SystemLivePresets

    cboVdeoProfile.Items.Add(Pset.Name)

     

    Next

    It appears that each one gets duplicated because I see the same name listed twice in my combo box.  Also, when I apply one of the presets to my job, I still don't get any audio.  The video looks great, but no audio.

  • Monday, November 02, 2009 7:35 PMDJMiller Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     

    I've done some more experimenting with the EE3 application.  When using the Live tab:  I select the video source (my TV card).  The video preview shows in the Cued area.  The only configuration options I get are the TV Tuner, Video Recording, and Video Crosspoint options.

    After selecting the TV card as my audio source, a new option shows up for the video.  I can now select the Tuner, S-Video or Composite.  These don't show up until AFTER I select the audio source.  Then if I select S-Video and then go back to TV Tuner, the audio level meter begins working and I can encode with Audio.  Still no audio with the Dazzle.

    How can I enumerate the video input sources of my TV Tuner card in the SDK?  I don't see anything in the object model.  I would like to duplicate the same functionality in my application.  My application has many other functions including synchronizing with PPT, FAQ, Captioning, Glossary, Resources, etc.  I really need to be able to use the SDK for live streaming.

    Sorry to be such a pain!

  • Wednesday, November 04, 2009 7:12 AMDean RoweMSFTUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Each device is controlled by interfaces specific to that device. However, you can use the SDK to invoke the configuration dialog of the device by calling the ShowConfigurationDialog method.
    Regards
    Dean.
  • Wednesday, November 04, 2009 2:04 PMDJMiller Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Dean,
    I can open the dialogs that you are referencing.  The selection for line input isn't a dialog.  It shows up in the Encoder application in a separate combo box from the dialogs.  You should borrow a tuner card from someone and see the behavior that I'm experiencing.  I saw another post on this forum where someone is also having trouble getting audio with their tuner card.

    I'm also interested to hear why you think the video dialogs/options change after I select the audio source.

    Is there any word on when EE4 is likely to be released?  I'm inclined to use WMEncoder 9 to re-write our application and wait to implement Expression Encoder until after some of these live issues are resolved.

    Dwight
  • Wednesday, November 04, 2009 5:11 PMDean RoweMSFTUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    I'll get our guy that worked on the live stuff to reply as he knows more about this area.

    (There's no info on the next version of Encoder yet, V3 hasn't been out all that long :-))
    Regards
    Dean.
  • Wednesday, November 04, 2009 5:59 PMSam Wookey [MSFT] Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Hi Dwight,

    Sorry you have been having issues with the SDK.

    As to your first question as to why the input line options change after selecting an audio device, that sounds like a bug in the UI. I'll open one up on our side and get it looked at.

    In terms of using the SDK to configure the input line options for your tuner card, these routines are marked as internal in the SDK, so only our UI has access to them. This looks like an oversight on our part. We tried to keep the SDK simple (as it is a V1 product) but it appears we were over aggressive in this case. I'll open a bug on this and make sure that these routines are exposed in the next version. Thanks for finding this!

    Also, we are planning on adding a bunch more samples in the next version, which hopefully will alleviate some of the pain in getting started with the SDK.

    As always, thanks for the feedback!
    Sam
  • Wednesday, November 04, 2009 8:40 PMDJMiller Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Thanks, I look forward to the next release.  I'm hoping it also has the screen capture as part of the sdk.  That would really make our product more marketable.  We'd be able to compete with Webex.