Migrating from Media Encoder Series 9 to Expression Encoder 4 RRS feed

  • Question

  • I've used Media Encoder Series 9 for a long time recording audio from a sound card to a WMA file via Visual Studio 2005.
    Media Encoder Series 9 does not work with a Windows 7 Pro 32bit machine.
    My code does not work with Expression Encoder 4 at all.
    Trying to upgrade to Expresson Encoder 4.

    Any VB.Net examples of how to simply record line in or mic audio from a sound card to a WMA format file?
    My old functions of record this input to this file using this codec and stopping the recording do not work.

    This looks like a whole new ball game with the Expression Encoder and I can't find any examples to get me started.





    Saturday, October 30, 2010 10:32 PM


  • Sorry, I mislead you here (did a little copy/paste snafu with an AacAudioProfile only call). Sorry for the confusion.

    Here's what you would do to set it up:

                                job.OutputFormat.AudioProfile = new WmaAudioProfile()


                                    Codec = AudioCodec.Wma,

                                    Bitrate = new ConstantBitrate(20),

                                    BitsPerSample = 16,

                                    Channels = 1,

                                    SamplesPerSecond = 22050



    Or in your other case:

                                job.OutputFormat.AudioProfile = new WmaAudioProfile()


                                    Codec = AudioCodec.Wma,

                                    Bitrate = new ConstantBitrate(48),

                                    BitsPerSample = 16,

                                    Channels = 1,

                                    SamplesPerSecond = 44100




    • Proposed as answer by Eric JuteauModerator Monday, November 1, 2010 9:37 PM
    • Marked as answer by B_Alan Tuesday, November 2, 2010 5:25 AM
    Monday, November 1, 2010 9:37 PM

All replies

  • Expression Encoder 4 is based on .Net 4.0 and thus require VS2010, which might be part of your problems.

    I would check the EE4 SDK documentation that's installed in the SDK directory of the application, especially the topic titled "Transitioning from the Windows Media Encoder SDK" to get you started. Also check the 15 samples we provided with the SDK. A few of them are Live-based and should get you started with your effort.

    Finally, please take note that while Expression Encoder is thriving to hit feature parity with Windows Media Encoder (we know we still have some ways to go), it never was meant to be backward compatible with its SDK. So unfortunately, you will not be able to take your WME code as is and use it with the EE4 SDK. Sorry for the inconvenience.

    Saturday, October 30, 2010 11:57 PM
  • Hey Eric thanks for replying.

    I've already moved everything over to VB2010 as I really don't have a choice without .NET 4.0 and Expression Encoder 4.

    I've managed to take the C# example in the SDK and convert parts of it, I'm close to getting it to work.

    I'll have to admit, it is a slicker looking code process than Media Encoder.

    It would be nice to have more VB examples in the SDK though...

    I'll let you know my progress.

    Sunday, October 31, 2010 12:33 AM

    I got Expressions Encoder to encode a wma file from the sound card input (mic and line in).
    Started with the Live Encoder example file in C# directory and converted it to VB.

    Still stumbling with WMA codec profiles though.

    I can't seem to pick a profile such as wmalossless or change any parameter when I record to a file.
    Reading the SDK help has not helped me yet.





    Sunday, October 31, 2010 4:45 AM

    Ok, I'm not getting anywhere.

    How do a apply a preset like WMAVoice to a live audio source I want to record like I could in Media Encoder Series 9??

    I'm using LiveJob and the only presets I can pull up are the video ones.
    Same source code as the C# Live Source example.
    I changed the deviceSource = Job.AddDeviceSource(video, audio)  to deviceSource = Job.AddDeviceSource(nothing, audio) cause I only want to encode audio.
    I can not find any other way to do this.  The code (intellisense) acts like I'm dealing with video AND audio, however the resultant encoded file is a wma audio only file.

    Is this a limitation of the software??   I'm starting to like WME Series 9 again.....





    Sunday, October 31, 2010 6:15 AM
  • As a rule of thumb, only things that are available in the application will be available in the SDK (and vice versa). When in doubt about any available functionality, it's worth checking the application if it's even possible.

    In this particular case, you would have found out that WMA and WMA Pro are the only two available codecs in WMA when in Live mode. In other words, WMA Voice or WMA Lossless aren't available in Live mode.

    Another issue comes in with changing parameters on the WMA side, one you should be very familiar with coming from WME: there are only a certain number of audio setting combinations that are valid when setting the WMA encoder, and they vary depending on the OS and version of the WMF SDK installed. I posted a sample list of the combinations I found on my Win7 PC here a while ago as a reference, but YMMV depending on your OS/Platform.

    Sunday, October 31, 2010 6:38 AM
  • As I said above, using either the app or the SDK, the WMAVoice codec isn't available in Live mode (though I now feel there is not particular reason why it shouldn't, so I'll open a bug on your behalf on the issue). You could easily do it in two steps though:

    1. Capture + Encode to File Archive in good quality WMA Pro

    2. Encode WMAPro -> WMA Voice (via offline Encoding)

    I'm not an expert in Live mode, but the rest of your described experience looks right to me: independently of the preset you selected, you're requesting an audio-only device to be created and you're getting a WMA audio-only file output since you don't have a video source. Maybe something's missing in your expectations layed out above?

    As for the stock LivePresets not including any audio only ones, I'm not exactly sure why (I'm not the Live expert of our team, but I'll open another bug on your behalf on the matter), but it certainly shouldn't stop you from changing the LiveJob.OutputFormat for your needs, including putting VideoProfile = null, which effectively forces the output to be audio WMA. In other words, the stock Presets we've included on both the Transcoding and Live experiences should be used as predefined sets of encoding parameters, like macros if you will, and not the end-all-be-all of what the application or the SDK can encode.

    Sunday, October 31, 2010 6:59 AM

    Ok great thank you for your insight.

    Are you saying that I need to install the WMA Voice Audio codec??

    Or there is no way to encode live audio to a file using WMAVoice period??

    In Media Encoder 9 I got a profile like this:

    ProfileName = "Windows Media Audio 8 for Dial-up Modem (Near CD quality, 48 Kbps)"

    And ecoded my live audio to that spec.


    Could I set the bitrates and quality another way without using presets?

    I would like the following:

    Wma Voice CBR 20 22050 16 1

    It was listed in your other post.

    Maybe I'm confusing presets with with profiles??  Is there a difference?

    I can record live audio fine to a wma file.  I just can't control the quality and size of the file it creates.

    Just can't quite get there yet.



    Sunday, October 31, 2010 7:45 AM
  • 1. As I wrote above, Expression Encoder 4 does not support encoding to WMA Voice codec in Live, nor does it support encoding using the WMA Lossless codec. I would stop trying to do it, it won't work until at the very least next version. :)

    2. The list of audio settings I pointed you to are for offline encoding, which is a superset of what is supported in Encoder's Live mode.

    3. In Encoder, a preset is just parts or the sum of all the video and audio encoding settings, which can applied on any MediaItem. The term "profile" is very loaded in video encoders and can mean a lot of things, which is why we stopped using it in the Encoder application. If my memory is correct, there is such a beast as WMA audio profiles in WME, which is a list of valid parameters that you can set in the WMA encoder included the WMFormat SDK (which is what my list in the other post comes from as we query the "profiles"). In WME, I remember it being a huge dropdown you could select every valid combination. We tried (and some would say failed) to make it more "usable" in our application by separating every setting and block the invalid options as the user selects his/her audio settings. I'm not saying it's pretty, but the feedback we got from our users is that it was better than the big dropdown. This unfortunately doesn't translate as well in the SDK, which is why we try to point users to using presets to make it as simple as possible. I know, you don't have access to those audio presets in Live mode, and as I said, I will open a bug for us to try to remedy this as soon as possible.

    4. You should be able to control the quality and size by setting the bitrate, sample rate and bit depth to a matching valid set from the list I pointed you in the WMA/WMAPro category for Live mode (feel free to use the application to test the settings first too). For example, the equivalent set you should be using to match the one above would be something like: Wma CBR 20 22050 16 1  (note that this is using the WMA codec, not WMA Voice). I've verified in the application that this profile is available on a Win7x64 PC and can be used to encode in Live.

    I appologize for the complexity of this whole WMA audio settings, it's unfortunately something we inherited from the WMF SDK and have to live with at this point.


    Sunday, October 31, 2010 9:51 AM

    Thank you for the information.  I think I understand now.
    Encoder Pro or Ultimate does not support the live WMAVoice Codec either, correct?

    Could you point me in a direction to use the correct methods for settings like WMA CBR 20 22050 16 1  ??

    I've got the encoder working to record live audio to a wma file, just can't get the bitrates down.
    Following the SDK has not produced an answer that I can see clearly.

    Or will I be forced to record the audio and then re-encode it to a smaller file as a non-live Job?  ( I really don't want to do that with my app's )

    Sunday, October 31, 2010 11:09 AM
  • FWIW, "Encoder Ultimate" doesn't exists. We have only 3 SKUs: standard (free), Pro without codecs (available only with MSDN/Spark programs) and Pro. All SKUs support encoding with the "WMA Voice" codec in offline mode (aka non-Live). 

    Check Bitrate and AudioProfile classes. Bitrate is a member of AudioProfile, and AudioProfile is a member of OutputFormat. And no, you won't have to re-encode, unless you specific need a WMA codec that it not available in Live mode (like WMA Voice for example).

    Sunday, October 31, 2010 4:17 PM
  • Public Class AudioRecorder
      Dim job As LiveJob
      Dim deviceSource As LiveDeviceSource
      Public Function RecordWma(ByVal OutPutFilePath As String) As Boolean
        job = New LiveJob()
        ''Dim video As EncoderDevice = If(EncoderDevices.FindDevices(EncoderDeviceType.Video).Count > 0, EncoderDevices.FindDevices(EncoderDeviceType.Video)(0), Nothing)
        Dim audio As EncoderDevice = If(EncoderDevices.FindDevices(EncoderDeviceType.Audio).Count > 0, EncoderDevices.FindDevices(EncoderDeviceType.Audio)(0), Nothing)
        ' Checks for a/v devices
        If audio IsNot Nothing Then
          ' Create a new device source. We use the first audio and video devices on the system
          deviceSource = job.AddDeviceSource(Nothing, audio)
          ' Make this source the active one
          MsgBox("Warning: No Audio Devices present")
        End If
        Dim fileOut As New FileArchivePublishFormat()
        ' Sets file path and name
        ' Note: output folder must be already created in C:
        fileOut.OutputFileName = OutPutFilePath
        ' Adds the format to the job. You can add additional formats as well such as
        job.OutputFormat.AudioProfile = WMALowQualityAudio <<<<<<<THIS DOES NOT WORK
        ' Start encoding
      End Function
      Public Sub StopEncoder()
        ' Stops encoding
        deviceSource = Nothing
      End Sub

    The above is what I'm using but I can not get Encoder to allow me to set the quality or the bitrate or anything other than the default 48kHz, CBR 1, 16 bits.
    I can't get any AudioProfile or Presets to work.

    There is not enough documentation to explain this that I can find anywhere.

    P.S. Eric, do you ever sleep??

    Sunday, October 31, 2010 8:58 PM
  • I think you're still mixing up the Profile and Preset concepts here. WMALowQualityAudio is a preset (a non-Live preset too), not an AudioProfile. To apply a preset, you have to use the job.ApplyPreset() method, but this particular preset won't work on a LiveJob.

    I think you will need to create your own AudioProfile in this case:
    job.OutputFormat.AudioProfile = new WmaAudioProfile(new ConstantBitrate(20), 1, 22050, 16);

    That should do what you wanted to do.

    Monday, November 1, 2010 6:21 AM
  • Intellisense tells me the line:

    job.OutputFormat.AudioProfile = New WmaAudioProfile(New ConstantBitrate(20), 1, 22050, 16)

    {No accessible New accepts this number of arguments}

    So how can I mimic the old MES9 audio profile of lets say: ProfileName = "Windows Media Audio 8 for Dial-up Modem (Near CD quality, 48 Kbps)"
    Which is a system profile of: WMProfile_V80_48StereoAudio (which should be ConstantBitrate(48), 1, 44100, 16)
    Or can I use any system profile for live encoding?

    I've got the latest Media Player and encoder installed so it should be on my Win7 32bit system correct?

    Whether it's ConstantBitrate(20), 1, 22050, 16) or ConstantBitrate(48), 1, 44100, 16) or whatever, just so I know how to change the settings.
    I have to control the size of the audio files as they are sent to small data devices.

    I just can't figure out how to implement it.

    I need help with {No accessible New accepts this number of arguments} and I think that: New WmaAudioProfile(New ConstantBitrate(20), 1, 22050, 16) is
    getting me closer.




    Monday, November 1, 2010 11:43 AM
  • Sorry, I mislead you here (did a little copy/paste snafu with an AacAudioProfile only call). Sorry for the confusion.

    Here's what you would do to set it up:

                                job.OutputFormat.AudioProfile = new WmaAudioProfile()


                                    Codec = AudioCodec.Wma,

                                    Bitrate = new ConstantBitrate(20),

                                    BitsPerSample = 16,

                                    Channels = 1,

                                    SamplesPerSecond = 22050



    Or in your other case:

                                job.OutputFormat.AudioProfile = new WmaAudioProfile()


                                    Codec = AudioCodec.Wma,

                                    Bitrate = new ConstantBitrate(48),

                                    BitsPerSample = 16,

                                    Channels = 1,

                                    SamplesPerSecond = 44100




    • Proposed as answer by Eric JuteauModerator Monday, November 1, 2010 9:37 PM
    • Marked as answer by B_Alan Tuesday, November 2, 2010 5:25 AM
    Monday, November 1, 2010 9:37 PM

    Ok, SUCCESS!

    For the VB coders out there this line will set your bitrate and etc. for a LiveJob:
       job.OutputFormat.AudioProfile = New WmaAudioProfile() With {.Codec = AudioCodec.Wma, .Bitrate = New ConstantBitrate(48), .BitsPerSample = 16, .Channels = 1, .SamplesPerSecond = 44100}

    MS, Please include more info like this in the SDK's.  It's a sea of methods and classes with very little guidence.
    So for us stubburn hard headed folk used to doing things another way, this is of most importance.

    It takes about a full scond longer to start the encoding process with Expression Encoder 4 as compared to Media Encoder Series 9.
    So I'm looking at that a little closer to see what I need to do or am able to speed that up a little.  MES9 was almost instant.  EE4 seems a wee bit slower there.

    Anyway, THANK YOU VERY MUCH Mr. Juteau!

    I'm starting the Eric Juteau fan club.  It's kinda like a Star Wars fan club, but cooler!

    The 3 scientist's are happy, the dolphins can phone home now, life is great!

    Thanks again!




    Tuesday, November 2, 2010 5:25 AM
  • Glad I could help. :)

    I'll relay your request for those types of samples to my team.

    Feel free to start up a new thread about the startup time discrepancy you're experiencing when comparing it to WME. Neither are real-time/low-latency solutions, but I don't think they should be very different in terms of timing, since they are sitting on the same SDKs.

    Tuesday, November 2, 2010 6:07 AM
  • Hi Eric,


    Just to clarify: if I'm going to work with  the SDK that comes with Expressions Encoder 4 I need to use Visual Studio 2010; Visual Studio 2005 is useless for this purpose. Do I have it right?



    Friday, April 8, 2011 8:21 PM
  • Hello,

    You are correct. You need Visual Studio 2010.



    Tuesday, April 12, 2011 9:05 PM