views:

10

answers:

1

I'm using the Expression Encoder 3 SDK and I'm trying to specify the output audio language. The ultimate reason I'm doing this is to encode an audio track as english and specify other, optional, audio tracks as other languages. Expression Encoder doesn't support this, but if you encode separate tracks as different languages, the Windows Media Stream Editor can put then together into one file.

I can't find any way to change the output language. I tried the Metadata tags, but that just puts a tag call language; it doesn't actually change the language LCID of the track. So, stream editor still sees it as english.

I've also tried setting the current thread's culture and UI culture, figuring it was picking it up from there. However, the SDK spins up tons of new threads internally and I think those are getting my culture change.

This is really annoying and i can't find anything anywhere about change language for encoder. The search terms are too generic and all i get are spec sheets on encoder. :( Please help!

A: 

I've found the answer and it's as I thought. It seems that you cannot change the output language from Expression Encoder 3. There is talk of multi-language support in Expression Encoder 4, but it seems limited, though I haven't tested it, to IIS Smooth Streaming.

The solution is to allow Encoder to output the audio file as english and then change the language after the fact.

I accomplished this using two open-source projects centered around DirectShow SDK and the Windows Media Format SDK. There are .NET wrappers for both of these located here: DirectShow and WMFormat.

The WindowsMediaNet project has a sample project called WMVCopy. This copies one WMV file to another, while rebuilding the headers, etc. It, however, does not re-encode the stream, it simply copies it from one file to the next. That's exactly what I wanted.

I modified the WMVCopy code to change the language of all of the streams:

int streamCount = 0;
m_pReaderProfile.GetStreamCount(out streamCount);
for (int streamIndex = 0; streamIndex < streamCount; streamIndex++)
{
    IWMStreamConfig stream = null;
    m_pReaderProfile.GetStream(streamIndex, out stream);

    ((IWMStreamConfig3)stream).SetLanguage(language);
    m_pReaderProfile.ReconfigStream(stream);
}

This loops through each stream and sets the language to the specified LCID string. The language must be in the form of en-us or ca-fr. The import part is the ReconfigureStream part. That method must be called for the change to actually take effect. You also need to make sure you do this after the reader profile is loaded.

I'm not sure if anyone else is every going to need to do this. But if so, I hope this helps.

Jason Sherman