Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

encoding multichannel audio using the ASFWriter

25 views
Skip to first unread message

Nick Ridley

unread,
Dec 18, 2007, 12:24:15 PM12/18/07
to
Hi,

I am trying to build a DirectShow graph to encode a 6 channel WAV into
a 5.1 WMA file.

I have generated a profile (below) and I add the ASFWriter to my graph
(I have version 11.0.5721.5145 of qasf.dll).

I call ConfigureFilterUsingProfile, and if for safety I call
GetCurrentProfile and check back the profile loaded in the writer it
is definitely the same one.

I then create an AsyncReader, load up the WAV file and try and connect
the output pin of that to the input of the ASFwriter (which correctly
only has one pin).

I get:
"No combination of intermediate filters could be found to make the
connection."

I get the same if I just Render the source file (which adds a
WaveParser and DSoundRenderer instead). I can then connect to the
graph and play with it.

If I edit my profile and make it 2 channels and swap the WAV for a
2channel one the graph builds, so I know my code is in essence sound.

I am tearing me hair out. This seems similar to what was fixed with
the v10 qasf.dll but I have loaded in WMFSDK11.

The media type on the output of the WaveParser filter is -

Mediatyp: Audio
Subtype: PCM audio
Format: Type WaveFormatEx Wave
Format: Unknown
Channels: 6
Samples/sec.: 44100
Avg. bytes/sec.:529200 Block align: 12
Bits/sample: 16

Is there anything I can do to make this work?

Thanks,
Nick


-----------------------------------------------------------------

profile version="589824"
storageformat="1"
name="High definition quality audio (VBR peak)"
description="">
<streamconfig
majortype="{73647561-0000-0010-8000-00AA00389B71}"
streamnumber="1"
streamname="Audio Stream"
inputname="Audio409"
bitrate="384000"
bufferwindow="-1"
reliabletransport="0"
decodercomplexity=""
rfc1766langid="en-us"
vbrenabled="1"
bitratemax="576048"
bufferwindowmax="2000">
<wmmediatype
subtype="{00000162-0000-0010-8000-00AA00389B71}"
bfixedsizesamples="1"
btemporalcompression="0"
lsamplesize="16384">
<waveformatex wFormatTag="354"
nChannels="6"
nSamplesPerSec="48000"
nAvgBytesPerSec="48000"
nBlockAlign="16384"
wBitsPerSample="24"
codecdata="18003F0000000000000000000000E0000000"/>
</wmmediatype>
</streamconfig>
</profile>

Alessandro Angeli

unread,
Dec 18, 2007, 12:42:39 PM12/18/07
to
From: "Nick Ridley"

> I then create an AsyncReader, load up the WAV file and
> try and connect the output pin of that to the input of
> the ASFwriter (which correctly only has one pin).

I think the WAVEFORMATEX structure in the WAV header (from
which the AM_MEDIA_TYPE output by the WAV parser is built)
should be a WAVEFORMATEXTENSIBLE.

Read the remarks here:

http://msdn2.microsoft.com/en-us/library/aa391547.aspx

Instead of changing the WAV header, you can write a custom
WAV pull-mode parser or a custom WAV push source or a custom
trans-in-place filter that simply makes a
WAVEFORMATEXTENSIBLE out of a WAVEFORMATEX.


--
// Alessandro Angeli
// MVP :: DirectShow / MediaFoundation
// mvpnews at riseoftheants dot com
// http://www.riseoftheants.com/mmx/faq.htm

Chris P.

unread,
Dec 18, 2007, 1:45:16 PM12/18/07
to
On Tue, 18 Dec 2007 12:42:39 -0500, Alessandro Angeli wrote:

> From: "Nick Ridley"
>
>> I then create an AsyncReader, load up the WAV file and
>> try and connect the output pin of that to the input of
>> the ASFwriter (which correctly only has one pin).
>
> I think the WAVEFORMATEX structure in the WAV header (from
> which the AM_MEDIA_TYPE output by the WAV parser is built)
> should be a WAVEFORMATEXTENSIBLE.
>
> Read the remarks here:
>
> http://msdn2.microsoft.com/en-us/library/aa391547.aspx
>
> Instead of changing the WAV header, you can write a custom
> WAV pull-mode parser or a custom WAV push source or a custom
> trans-in-place filter that simply makes a
> WAVEFORMATEXTENSIBLE out of a WAVEFORMATEX.

There is a sample of such a trans-ip filter on my website that is free to
use. "Legacy HD Audio Filter"
http://www.chrisnet.net/code.htm

--
http://www.chrisnet.net/code.htm
[MS MVP for DirectShow / MediaFoundation]

babgvant

unread,
Dec 19, 2007, 10:03:11 AM12/19/07
to
On Dec 18, 12:45 pm, "Chris P." <m...@chrisnet.net> wrote:

> There is a sample of such a trans-ip filter on my website that is free to
> use. "Legacy HD Audio Filter"http://www.chrisnet.net/code.htm
>

> --http://www.chrisnet.net/code.htm


> [MS MVP for DirectShow / MediaFoundation]

I've tried using your transform filter for this in the past and
haven't been able to get it to work. Should it work as is or does it
require modification to make this go?

Chris P.

unread,
Dec 19, 2007, 11:11:09 AM12/19/07
to

Were you trying to compile it or use the DLL filter? It should work as is
without modification.

--

Nick Ridley

unread,
Dec 19, 2007, 1:19:24 PM12/19/07
to
On Wed, 19 Dec 2007 07:03:11 -0800 (PST), babgvant <ava...@gmail.com>
wrote:


Thanks for the help everyone - that makes sense.

I had a go with the AudioTypeConverter filter, but checking the
MediaType on the output pin the formatType Guid is still that of
WaveEx i.e. 05589f81-c356-11ce-bf01-00aa0055595a. HOwver the subtype
is 00000001-0000-0010-8000-00aa00389b71 which looks like it should be
KSDATAFORMAT_SUBTYPE_PCM. However when I hook the pin up to the
ASFwriter it still won't do it. The profile definitely expects 16bit
44.1Khz 5.1 and the source file is just that.

Do I have to configure the filter via its interface to get it to work?
I had a look through the source code and got the feeling that was just
for future expansion.

Thanks,
Nick

Chris P.

unread,
Dec 19, 2007, 1:40:49 PM12/19/07
to

Hmm. Let me make sure the correct source code is up there, as I also had a
"template" audio filter. In the meantime try the binary download, I know
that one works as people are using it.

--

Chris P.

unread,
Dec 19, 2007, 5:55:56 PM12/19/07
to
On Wed, 19 Dec 2007 13:40:49 -0500, Chris P. wrote:

>>
>> I had a go with the AudioTypeConverter filter, but checking the
>> MediaType on the output pin the formatType Guid is still that of
>> WaveEx i.e. 05589f81-c356-11ce-bf01-00aa0055595a. HOwver the subtype
>> is 00000001-0000-0010-8000-00aa00389b71 which looks like it should be
>> KSDATAFORMAT_SUBTYPE_PCM. However when I hook the pin up to the
>> ASFwriter it still won't do it. The profile definitely expects 16bit
>> 44.1Khz 5.1 and the source file is just that.
>>
>> Do I have to configure the filter via its interface to get it to work?
>> I had a look through the source code and got the feeling that was just
>> for future expansion.
>
> Hmm. Let me make sure the correct source code is up there, as I also had a
> "template" audio filter. In the meantime try the binary download, I know
> that one works as people are using it.

I checked the source code posted and it is correct although badly
commented. On the output pin the advertised wave format should look like
WaveFormatEx except the waveID will be 0xfffffffe and the cbSize = 22.

However it unfortunately does not seem to be working with the ASF writer
correctly when I passed it my sample wave file. I ended up with 5
converters, an indeo audio decoder and an ACM Wrapper in between. I will
debug the format negotiation a little bit and see what is going on.

Nick Ridley

unread,
Dec 20, 2007, 3:38:24 AM12/20/07
to
On Wed, 19 Dec 2007 17:55:56 -0500, "Chris P." <ms...@chrisnet.net>
wrote:

Hi Chris - I am interested to hear that. The first time I made the
connection that is exactly what I got, and I unregistered the
AudioTypeConverter filter, then re-registered it and since then have
never got that chain, just a failure to connect. I'll be glad to see
what you discover as I have had that happen to me before (I've been
using AudioTypeConverter for a few months to handle BWAVs).

Regards,
Nick

ROOT6 Technology

babgvant

unread,
Dec 20, 2007, 10:24:55 AM12/20/07
to
> --http://www.chrisnet.net/code.htm

> [MS MVP for DirectShow / MediaFoundation]

Thank you.

Chris P.

unread,
Dec 20, 2007, 6:29:02 PM12/20/07
to
On Thu, 20 Dec 2007 08:38:24 +0000, Nick Ridley wrote:

> Hi Chris - I am interested to hear that. The first time I made the
> connection that is exactly what I got, and I unregistered the
> AudioTypeConverter filter, then re-registered it and since then have
> never got that chain, just a failure to connect. I'll be glad to see
> what you discover as I have had that happen to me before (I've been
> using AudioTypeConverter for a few months to handle BWAVs).

I fixed the bug that caused the chaining. It was allowing a transform from
WAVEFORMATEXTENSIBLE to WAVEFORMATEXTENSIBLE which created this circular
loop. I've limited the filter to only accept WAVEFORMATEX on the input
(cbSize=0) and have WAVEFORMATEXTENSIBLE on the output.

However I've come to the conclusion that the WM ASF Writer filter does not
support WAVEFORMATEXTENSIBLE even though the unlaying Writer object does.
I don't know of any workaround other than re-writing the wrapper filter.

Chris P.

unread,
Dec 20, 2007, 6:55:48 PM12/20/07
to
On Thu, 20 Dec 2007 18:29:02 -0500, Chris P. wrote:

> However I've come to the conclusion that the WM ASF Writer filter does not
> support WAVEFORMATEXTENSIBLE even though the unlaying Writer object does.
> I don't know of any workaround other than re-writing the wrapper filter.

Well I could of just got smart and read the source code like Alessandro
did. The WM ASF Writer definitely does not support WAVEFORMATEXTENSIBLE,
however Alessandro has an idea that I believe will work!

Alessandro Angeli

unread,
Dec 20, 2007, 6:59:45 PM12/20/07
to
From: "Chris P."

> However I've come to the conclusion that the WM ASF
> Writer filter does not support WAVEFORMATEXTENSIBLE even
> though the unlaying Writer object does. I don't know of
> any workaround other than re-writing the wrapper filter.

And we have winner! :-) According to the WMASFWriter filter,
WAVE_FORMAT_EXTENSIBLE is a compressed format regardless of
the SubFormat field, so it will try to pass it on to the
WMWriter object as a pre-compressed type and fail.

The only workaround I can think of is to use the WMA DMO
encoder directly through the DMOWrapper, which should not
make any assumptions on the meaning of the media type, then
configure the WMASFWriter to receive pre-compressed streams.

Otherwise, you can use the WMWriter directly in your own
custom sink filter or in the application, extracting the
data from the graph using the SampleGrabber or a custom
sink/grabber.

Last, since your input is a WAV file, if I were you I would
give up on DirectShow and just read the WAV file myself
(since it is *very* easy) and use the WMWriter directly,
which would require a lot less code. Take a look at the
UncompAVIToWMV sample in the WMF SDK, which does just that
(the name is misleaing: it also supports uncompressed WAVs);
you may need to modify it a little to adapt the WAVEFORMATEX
in the WAV header to a WAVEFORMATEXTENSIBLE for the
WMProfile.

babgvant

unread,
Dec 21, 2007, 10:04:03 AM12/21/07
to
On Dec 20, 5:55 pm, "Chris P." <m...@chrisnet.net> wrote:
> On Thu, 20 Dec 2007 18:29:02 -0500, Chris P. wrote:
> > However I've come to the conclusion that the WM ASF Writer filter does not
> > support WAVEFORMATEXTENSIBLE even though the unlaying Writer object does.
> > I don't know of any workaround other than re-writing the wrapper filter.
>
> Well I could of just got smart and read the source code like Alessandro
> did. The WM ASF Writer definitely does not support WAVEFORMATEXTENSIBLE,
> however Alessandro has an idea that I believe will work!
>
> --http://www.chrisnet.net/code.htm

> [MS MVP for DirectShow / MediaFoundation]

The source code for WM ASF Writer is available?

Chris P.

unread,
Dec 21, 2007, 10:15:21 AM12/21/07
to

It's only available to MVP's and Microsoft partners that have signed up for
source code access. We have view only access to a subset of the Microsoft
OS code base. But don't be too disappointed as the WM ASF Writer is not
really all that interesting. It is just a light wrapper over the Format
SDK that lays beneath for which source code is NOT available.

--

The March Hare [MVP]

unread,
Dec 21, 2007, 10:16:48 AM12/21/07
to
On Fri, 21 Dec 2007 07:04:03 -0800 (PST), babgvant wrote:

> The source code for WM ASF Writer is available?

No unless you have:

http://www.microsoft.com/resources/sharedsource/ccp/premium.mspx

However, the sample that Alessandro pointed you to has source code. It is
in the WM Format SDK.

--
Please read this before replying:
1. Dshow & posting help: http://tmhare.mvps.org/help.htm
2. Trim & respond inline (please don't top post or snip everything)
3. Benefit others: follow up if you are helped or you found a solution

babgvant

unread,
Dec 22, 2007, 10:33:21 PM12/22/07
to
On Dec 21, 9:16 am, "The March Hare [MVP]"

Unfortunately, that application (the one Alessandro mentioned) doesn't
help me; the media I'm trying to convert isn't uncompressed.

babgvant

unread,
Dec 22, 2007, 10:39:17 PM12/22/07
to

does it accept the WaveFormatEx structure referenced below?

"The multi-channel output types supported by the Windows Media Audio
Professional codec do not use WAVEFORMATEXTENSIBLE, but report the
correct number of channels and bits per sample in the WAVEFORMATEX
structure."

If so, would it be possible to write a reverse version of your Legacy
HD Audio transformation filter?

Chris P.

unread,
Dec 24, 2007, 10:41:08 AM12/24/07
to
On Sat, 22 Dec 2007 19:39:17 -0800 (PST), babgvant wrote:

> does it accept the WaveFormatEx structure referenced below?
>
> "The multi-channel output types supported by the Windows Media Audio
> Professional codec do not use WAVEFORMATEXTENSIBLE, but report the
> correct number of channels and bits per sample in the WAVEFORMATEX
> structure."
>
> If so, would it be possible to write a reverse version of your Legacy
> HD Audio transformation filter?

It did not. When I created a media type of > 2 channels and still
WAVEFORMATEX it refused the connection.

--

Chris P.

unread,
Dec 24, 2007, 10:44:14 AM12/24/07
to
On Mon, 24 Dec 2007 10:41:08 -0500, Chris P. wrote:

> On Sat, 22 Dec 2007 19:39:17 -0800 (PST), babgvant wrote:
>
>> does it accept the WaveFormatEx structure referenced below?
>>
>> "The multi-channel output types supported by the Windows Media Audio
>> Professional codec do not use WAVEFORMATEXTENSIBLE, but report the
>> correct number of channels and bits per sample in the WAVEFORMATEX
>> structure."
>>
>> If so, would it be possible to write a reverse version of your Legacy
>> HD Audio transformation filter?
>
> It did not. When I created a media type of > 2 channels and still
> WAVEFORMATEX it refused the connection.

How about using the Windows Media DMO? That *did* work in my testing, just
you can't test it effectively in graphEdit because the stupid WM Writer
doesn't let you select a relevant profile.

Chris P.

unread,
Dec 24, 2007, 11:31:50 AM12/24/07
to
On Sat, 22 Dec 2007 19:39:17 -0800 (PST), babgvant wrote:

> "The multi-channel output types supported by the Windows Media Audio
> Professional codec do not use WAVEFORMATEXTENSIBLE, but report the
> correct number of channels and bits per sample in the WAVEFORMATEX
> structure."

Note that here it is referring to the compressed WMA data stream not the
uncompressed PCM, so it's not relevant. On the input side it expects
WAVEFORMATEXTENSIBLE. Using the AudioTypeConvert filter I was able to
successfully connect to the Windows Media encoder DMO from a multi-channel
source file. The compressed stream can then be connected to the WM Writer
once an appropriate profile is loaded.

--

Alessandro Angeli

unread,
Dec 24, 2007, 9:58:45 PM12/24/07
to
From: "babgvant"

> Unfortunately, that application (the one Alessandro
> mentioned) doesn't help me; the media I'm trying to
> convert isn't uncompressed.

The WM[ASF]Writer only acceps uncompressed PCM data in input
if you want it to compress to WMA and it doesn't matter
where your PCM data comes from: the sample shows how to use
the WMWriter to compress PCM to WMA and it shows how to
featch the PCM data from uncompressed AVI/WAV files, but
nobody is stopping you from modifying the sample to fetch
data any other way or to just use it as a reference to write
your own code.

babgvant

unread,
Dec 25, 2007, 7:04:03 PM12/25/07
to

> --http://www.chrisnet.net/code.htm


> [MS MVP for DirectShow / MediaFoundation]

this is one approach I'm looking at. my first go at it fails when I
try to connect the DMO to the audio input pin on the asf writer.
Still doing research on how to configure the dmo so I can't eliminate
the possibility that I'm not doing it correctly.

babgvant

unread,
Dec 25, 2007, 7:13:48 PM12/25/07
to
On Dec 24, 8:58 pm, "Alessandro Angeli" <nob...@nowhere.in.the.net>
wrote:

> The WM[ASF]Writer only acceps uncompressed PCM data in input
> if you want it to compress to WMA and it doesn't matter
> where your PCM data comes from: the sample shows how to use
> the WMWriter to compress PCM to WMA and it shows how to
> featch the PCM data from uncompressed AVI/WAV files, but
> nobody is stopping you from modifying the sample to fetch
> data any other way or to just use it as a reference to write
> your own code.
>
> --
> // Alessandro Angeli
> // MVP :: DirectShow / MediaFoundation
> // mvpnews at riseoftheants dot com
> //http://www.riseoftheants.com/mmx/faq.htm

The content I'm trying to convert is ac3 audio and mpeg video stored
in a dvr-ms container, so while it should be possible to use non-
directshow methods to read and uncompress the data before using the
WMF to compress the streams; I haven't had much success with it.

babgvant

unread,
Dec 25, 2007, 7:32:18 PM12/25/07
to
On Dec 25, 6:13 pm, babgvant <avan...@gmail.com> wrote:
>
> The content I'm trying to convert is ac3 audio and mpeg video stored
> in a dvr-ms container, so while it should be possible to use non-
> directshow methods to read and uncompress the data before using the
> WMF to compress the streams; I haven't had much success with it.

Should include that I'm a complete newb in this area, so my level of
success is probably directly proportional :)

Alessandro Angeli

unread,
Dec 25, 2007, 9:35:37 PM12/25/07
to
From: "babgvant"

> The content I'm trying to convert is ac3 audio and mpeg
> video stored in a dvr-ms container, so while it should be
> possible to use non- directshow methods to read and
> uncompress the data before using the WMF to compress the
> streams; I haven't had much success with it.

You can build a decoding graph where you replace the
renderers with SampleGrabber's configured in sample mode
followed by NullRenderers,
that way you receive the uncompressed a/v data in the
callbacks and you can just pass it along to a WMWriter
object outside of the DS graph. You can make it even more
efficient if you write your own grabber or renderer that
wraps the WMWriter's INSSBuffer objects in IMediaSample
ones, to avoid a buffer copy.

The DS SDK contains 2 sample renderers (SampVid and Synth)
but you might do better by just creating a filter based on
CBaseFilter (or CBaseRenderer) and 2 CBaseInputPin's instead
of using CBaseRenderer and having 2 instances. The old DS
SDK included with the DirectX SDK 9.0b from 2003 or 2004
also contains a grabber sample equivalent to the
SampleGrabber used in sample mode or a sink with 1 input
pin.

Chris P.

unread,
Dec 26, 2007, 11:36:14 AM12/26/07
to
On Tue, 25 Dec 2007 16:04:03 -0800 (PST), babgvant wrote:

> this is one approach I'm looking at. my first go at it fails when I
> try to connect the DMO to the audio input pin on the asf writer.
> Still doing research on how to configure the dmo so I can't eliminate
> the possibility that I'm not doing it correctly.

You have to configure the DMO, and most importantly you have to configure
the ASF Writer to let it know you are passing in compressed samples by
supplying the appropriate profile and by calling:
IConfigASFWriter::SetParam(AM_CONFIGASFWRITER_PARAM_DONTCOMPRESS, TRUE, 0);

Call SetParam() and then set the profile.

--

babgvant

unread,
Dec 27, 2007, 9:42:10 AM12/27/07
to
> --http://www.chrisnet.net/code.htm

> [MS MVP for DirectShow / MediaFoundation]

I am calling SetParam to notify the writer. Then using the
AMMediaType (WMMediaType) retrieved from the profile's IWMMediaProps
to find the correct output type from the DMO, setting it using the
IMediaObject SetOutputType, but when I try to connectdirect the pins
it fails.

babgvant

unread,
Dec 27, 2007, 10:38:08 AM12/27/07
to
On Dec 25, 8:35 pm, "Alessandro Angeli" <nob...@nowhere.in.the.net>
wrote:
>

> You can build a decoding graph where you replace the
> renderers with SampleGrabber's configured in sample mode
> followed by NullRenderers,
> that way you receive the uncompressed a/v data in the
> callbacks and you can just pass it along to a WMWriter
> object outside of the DS graph. You can make it even more
> efficient if you write your own grabber or renderer that
> wraps the WMWriter's INSSBuffer objects in IMediaSample
> ones, to avoid a buffer copy.
>
> The DS SDK contains 2 sample renderers (SampVid and Synth)
> but you might do better by just creating a filter based on
> CBaseFilter (or CBaseRenderer) and 2 CBaseInputPin's instead
> of using CBaseRenderer and having 2 instances. The old DS
> SDK included with the DirectX SDK 9.0b from 2003 or 2004
> also contains a grabber sample equivalent to the
> SampleGrabber used in sample mode or a sink with 1 input
> pin.
>
> --
> // Alessandro Angeli
> // MVP :: DirectShow / MediaFoundation
> // mvpnews at riseoftheants dot com
> //http://www.riseoftheants.com/mmx/faq.htm

Do you think this approach is better/easier than creating my own wm
asf writer (or is that essentially what' you're suggesting)?

Chris P.

unread,
Dec 27, 2007, 10:56:32 AM12/27/07
to
On Thu, 27 Dec 2007 06:42:10 -0800 (PST), babgvant wrote:

> I am calling SetParam to notify the writer. Then using the
> AMMediaType (WMMediaType) retrieved from the profile's IWMMediaProps
> to find the correct output type from the DMO, setting it using the
> IMediaObject SetOutputType, but when I try to connectdirect the pins
> it fails.

Can you show the profile that you are using?

--

babgvant

unread,
Dec 27, 2007, 1:33:18 PM12/27/07
to
On Dec 27, 9:56 am, "Chris P." <m...@chrisnet.net> wrote:
> On Thu, 27 Dec 2007 06:42:10 -0800 (PST), babgvant wrote:
> > I am calling SetParam to notify the writer. Then using the
> > AMMediaType (WMMediaType) retrieved from the profile's IWMMediaProps
> > to find the correct output type from the DMO, setting it using the
> > IMediaObject SetOutputType, but when I try to connectdirect the pins
> > it fails.
>
> Can you show the profile that you are using?
>
> --http://www.chrisnet.net/code.htm

> [MS MVP for DirectShow / MediaFoundation]

Profile below. Thanks for helping me btw.

<profile version="589824"
storageformat="1"
name="CBR HD WMV"
description="">
<streamconfig
majortype="{73647561-0000-0010-8000-00AA00389B71}"
streamnumber="1"
streamname="Audio Stream"
inputname="Audio409"
bitrate="440016"
bufferwindow="5000"
reliabletransport="0"
decodercomplexity=""
rfc1766langid="en-us"
>
<wmmediatype
subtype="{00000162-0000-0010-8000-00AA00389B71}"
bfixedsizesamples="1"
btemporalcompression="0"
lsamplesize="9387">
<waveformatex wFormatTag="354"
nChannels="6"
nSamplesPerSec="48000"
nAvgBytesPerSec="55002"
nBlockAlign="9387"
wBitsPerSample="16"

codecdata="10003F0000000000000000000000E0000000"/>
</wmmediatype>
</streamconfig>
<streamconfig
majortype="{73646976-0000-0010-8000-00AA00389B71}"
streamnumber="2"
streamname="Video Stream"
inputname="Video409"
bitrate="5000000"
bufferwindow="5000"
reliabletransport="0"
decodercomplexity="AU"
rfc1766langid="en-us"
>
<videomediaprops maxkeyframespacing="200000000"
quality="80"/>
<wmmediatype
subtype="{33564D57-0000-0010-8000-00AA00389B71}"
bfixedsizesamples="0"
btemporalcompression="1"
lsamplesize="0">
<videoinfoheader dwbitrate="5000000"
dwbiterrorrate="0"
avgtimeperframe="333667">
<rcsource left="0"
top="0"
right="1280"
bottom="720"/>
<rctarget left="0"
top="0"
right="1280"
bottom="720"/>
<bitmapinfoheader biwidth="1280"
biheight="720"
biplanes="1"
bibitcount="24"
bicompression="WMV3"
bisizeimage="0"
bixpelspermeter="0"
biypelspermeter="0"
biclrused="0"
biclrimportant="0"/>
</videoinfoheader>
</wmmediatype>
</streamconfig>
</profile>

Chris P.

unread,
Dec 27, 2007, 1:50:12 PM12/27/07
to
On Thu, 27 Dec 2007 10:33:18 -0800 (PST), babgvant wrote:

> Profile below. Thanks for helping me btw.

The audio profile appears complete. I'll try to make a full test of the
same thing and let you know. Will be either this afternoon or tomorrow.

--

Alessandro Angeli

unread,
Dec 29, 2007, 10:55:13 PM12/29/07
to
From: "babgvant"

> Do you think this approach is better/easier than creating
> my own wm asf writer (or is that essentially what' you're
> suggesting)?

It's essentially the same thing: a custom "WMASFWriter" is
nothing else than a sink filter that wraps the WMWriter
object and a trans-in-place grabber filter and the WMWriter
outside the graph performs the same operations, just with
less and simpler code because you can use the StockSample
grabber or the Grabber sample without having to deal with
the complexities of creating a sink filter.

gva...@gmail.com

unread,
Jan 1, 2008, 3:18:27 PM1/1/08
to
On Dec 29 2007, 9:55 pm, "Alessandro Angeli"

<nob...@nowhere.in.the.net> wrote:
>
> It's essentially the same thing: a custom "WMASFWriter" is
> nothing else than a sink filter that wraps the WMWriter
> object and a trans-in-place grabber filter and the WMWriter
> outside the graph performs the same operations, just with
> less and simpler code because you can use the StockSample
> grabber or the Grabber sample without having to deal with
> the complexities of creating a sink filter.
>
> --
> // Alessandro Angeli
> // MVP :: DirectShow / MediaFoundation
> // mvpnews at riseoftheants dot com
> //http://www.riseoftheants.com/mmx/faq.htm

I'm not having much success with the sample grabber approach. Audio
seems to work ok (I receive samples and am able to translate the
IMediaSample into a INSSBuffer and pass it to the IWMWriter without
error. But the sample grabber for video never receives samples.

I've started working on a version of the Dump sample that wraps
IWMWriter (and has two pins) because I can't get the DMO approach
going either. This is as good an excuse as any to get some experience
writing filters :)

babgvant

unread,
Jan 3, 2008, 4:57:01 PM1/3/08
to
On Dec 27 2007, 12:50 pm, "Chris P." <m...@chrisnet.net> wrote:
> On Thu, 27 Dec 2007 10:33:18 -0800 (PST), babgvant wrote:
> > Profile below. Thanks for helping me btw.
>
> The audio profile appears complete. I'll try to make a full test of the
> same thing and let you know. Will be either this afternoon or tomorrow.
>
> --http://www.chrisnet.net/code.htm

> [MS MVP for DirectShow / MediaFoundation]

have you had a chance to test this out?

Chris P.

unread,
Jan 4, 2008, 10:56:33 AM1/4/08
to

I'm sorry I have not, the holidays messed me up. I should have time this
weekend to play with it.

--

babgvant

unread,
Jan 5, 2008, 10:51:15 AM1/5/08
to
On Jan 4, 9:56 am, "Chris P." <m...@chrisnet.net> wrote:
>
> I'm sorry I have not, the holidays messed me up. I should have time this
> weekend to play with it.
>
> --http://www.chrisnet.net/code.htm
> [MS MVP for DirectShow / MediaFoundation]

no need to apologize, I'm happy to wait as long as it takes :)

Chris P.

unread,
Jan 8, 2008, 11:28:16 AM1/8/08
to

I got it to work in code without too much trouble. I'll post the code
steps shortly after I clean it up a touch.

--

Chris P.

unread,
Jan 8, 2008, 1:57:56 PM1/8/08
to
On Tue, 8 Jan 2008 11:28:16 -0500, Chris P. wrote:

> I got it to work in code without too much trouble. I'll post the code
> steps shortly after I clean it up a touch.


Ok, so here are the links.

6-channel 96kHz legacy wave file.
http://chrisnet.net/samples/HDWMA/6ch_96khz_3sec.rar

6-channel 96kHz ASF Profile (no video)
http://chrisnet.net/samples/HDWMA/6.1_96khz_profb.prx

GraphEdit image as pulled up by connecting to remote graph
http://chrisnet.net/samples/HDWMA/wav_to_asf_convert.PNG

Sample code to build the encoding graph (not a full app)
http://chrisnet.net/samples/HDWMA/wav_to_asf_sample.cpp


The code doesn't check for errors as it was written quick and dirty style.
It was only written with the intention of running it inside the debugger
and "stepping" through the code.

You may also need to update your build of the AudioTypeConvert filter to
get it to work correctly. There was a small bug that prevented it from
working correctly with Windows Media Encoder which I corrected. In fact I
generated the encoding profile with WME and then exported it to use in the
sample.

AudioTypeConvert filter source code:
http://chrisnet.net/samples/AudioTypeConvertSource.zip
Compiled filter:
http://chrisnet.net/msdn/AudioTypeConvert.zip

Let me know if you have any questions.

Message has been deleted

babgvant

unread,
Jan 9, 2008, 10:12:16 PM1/9/08
to
On Jan 8, 12:57 pm, "Chris P." <m...@chrisnet.net> wrote:
>
> Ok, so here are the links.
>
> 6-channel 96kHz legacy wave file.http://chrisnet.net/samples/HDWMA/6ch_96khz_3sec.rar
>
> 6-channel 96kHz ASF Profile (no video)http://chrisnet.net/samples/HDWMA/6.1_96khz_profb.prx
>
> GraphEdit image as pulled up by connecting to remote graphhttp://chrisnet.net/samples/HDWMA/wav_to_asf_convert.PNG
>
> Sample code to build the encoding graph (not a full app)http://chrisnet.net/samples/HDWMA/wav_to_asf_sample.cpp

>
> The code doesn't check for errors as it was written quick and dirty style.
> It was only written with the intention of running it inside the debugger
> and "stepping" through the code.
>
> You may also need to update your build of the AudioTypeConvert filter to
> get it to work correctly. There was a small bug that prevented it from
> working correctly with Windows Media Encoder which I corrected. In fact I
> generated the encoding profile with WME and then exported it to use in the
> sample.
>
> AudioTypeConvert filter source code:http://chrisnet.net/samples/AudioTypeConvertSource.zip
> Compiled filter:http://chrisnet.net/msdn/AudioTypeConvert.zip
>
> Let me know if you have any questions.
>
> --http://www.chrisnet.net/code.htm

> [MS MVP for DirectShow / MediaFoundation]

Thanks for the sample.

I can't get the code sample to work with my file. I'm getting the same
error message when I try to connect the pins b/w the asf writer and
the dmo that I was getting before. The file converts fine using the
windows media encoder with the profile I'm using after converting it
to mpeg (wme doesn't like dvr-ms files).

I've uploaded the code (your code in a project with some minor
modifications) and a small sample file. If you have time and
inclination I'd appreciate the input.

http://babgvant.com/downloads/dmotest.zip

Thanks.

Chris P.

unread,
Jan 10, 2008, 10:58:42 AM1/10/08
to
On Wed, 9 Jan 2008 19:12:16 -0800 (PST), babgvant wrote:

> Thanks for the sample.
>
> I can't get the code sample to work with my file. I'm getting the same
> error message when I try to connect the pins b/w the asf writer and
> the dmo that I was getting before. The file converts fine using the
> windows media encoder with the profile I'm using after converting it
> to mpeg (wme doesn't like dvr-ms files).
>
> I've uploaded the code (your code in a project with some minor
> modifications) and a small sample file. If you have time and
> inclination I'd appreciate the input.
>
> http://babgvant.com/downloads/dmotest.zip

I'm taking a look. Although for starters your profile is wrong, the WMA
sample rate doesn't match the input sample rate. The encoder is going to
output 48kHz but you're profile says 44.1kHz.

--

Chris P.

unread,
Jan 10, 2008, 11:36:09 AM1/10/08
to

Yep, works fine here. I'm using AC3 filter with the output configured for
5.1 (6 channel) 24-bit audio. I used my sample profile changing the sample
rate to 48kHz and the bitrate to 384000.

babgvant

unread,
Jan 11, 2008, 12:24:05 PM1/11/08
to
On Jan 10, 10:36 am, "Chris P." <m...@chrisnet.net> wrote:
> > I'm taking a look. Although for starters your profile is wrong, the WMA
> > sample rate doesn't match the input sample rate. The encoder is going to
> > output 48kHz but you're profile says 44.1kHz.
>
> Yep, works fine here. I'm using AC3 filter with the output configured for
> 5.1 (6 channel) 24-bit audio. I used my sample profile changing the sample
> rate to 48kHz and the bitrate to 384000.
>
> --http://www.chrisnet.net/code.htm

> [MS MVP for DirectShow / MediaFoundation]

I must have forgot to change it back before uploading. I had
configured ffdshow to resample to 44.1 (one of many things I tried).

Maybe there's something jacked on my pc because I still can't get it
to work. When I connect the pins b/w the dmo and the asf writer I
still get:

Unhandled exception at 0x6ad735c1 in CPPTest.exe: 0xC0000005: Access
violation reading location 0x00000000.

http://babgvant.com/downloads/modmo.zip

- updated prx
- updated cpp file (had to make some changes after installing
ac3filter)
- screenshot of ac3filter config
- screenshot of grf, and xgr

Didn't mention that I'm using Vista before, should that make a
difference?

Chris P.

unread,
Jan 11, 2008, 3:25:12 PM1/11/08
to
On Fri, 11 Jan 2008 09:24:05 -0800 (PST), babgvant wrote:

> I must have forgot to change it back before uploading. I had
> configured ffdshow to resample to 44.1 (one of many things I tried).
>
> Maybe there's something jacked on my pc because I still can't get it
> to work. When I connect the pins b/w the dmo and the asf writer I
> still get:
>
> Unhandled exception at 0x6ad735c1 in CPPTest.exe: 0xC0000005: Access
> violation reading location 0x00000000.
>
> http://babgvant.com/downloads/modmo.zip
>
> - updated prx
> - updated cpp file (had to make some changes after installing
> ac3filter)
> - screenshot of ac3filter config
> - screenshot of grf, and xgr

I am not using ffdshow in my graph. It has the stock MPEG-2 demultiplexer
and the AC3Filter decoder. When I installed AC3Filter the first time I
installed the ACM decoder as well which caused problems during enumeration.
I had to uninstall and reinstall just the DirectShow component.



> Didn't mention that I'm using Vista before, should that make a
> difference?

It could. I did not test in that environment, and it has the v11 Format
SDK where as I was testing with v9 on XP.

--

babgvant

unread,
Jan 11, 2008, 5:02:18 PM1/11/08
to
On Jan 11, 2:25 pm, "Chris P." <m...@chrisnet.net> wrote:
>
> I am not using ffdshow in my graph. It has the stock MPEG-2 demultiplexer
> and the AC3Filter decoder. When I installed AC3Filter the first time I
> installed the ACM decoder as well which caused problems during enumeration.
> I had to uninstall and reinstall just the DirectShow component.

doh... that would have been much easier than figuring out how to load
a DMO by device name :)

I'll do that, thx for the tip.

babgvant

unread,
Jan 15, 2008, 12:29:01 PM1/15/08
to
On Jan 11, 2:25 pm, "Chris P." <m...@chrisnet.net> wrote:
> It could. I did not test in that environment, and it has the v11 Format
> SDK where as I was testing with v9 on XP.

I had a chance to put a XP VM together last night to test this out,
and it works.

Any ideas on how I can get this working on Vista?

Chris P.

unread,
Jan 15, 2008, 1:53:28 PM1/15/08
to

It's probably not Vista but rather the Format SDK version. If you update
your XP VM box to WMF Runtime 11 (or WMP 11) does it stop working?

babgvant

unread,
Jan 16, 2008, 10:35:35 AM1/16/08
to
On Jan 15, 12:53 pm, "Chris P." <m...@chrisnet.net> wrote:
> It's probably not Vista but rather the Format SDK version. If you update
> your XP VM box to WMF Runtime 11 (or WMP 11) does it stop working?
>

Yes.

Chris P.

unread,
Jan 16, 2008, 11:11:08 AM1/16/08
to

Great ... another broken "upgrade".

I'll take a look and see what I can figure out. Hopefully they didn't
break it completely.

babgvant

unread,
Jan 16, 2008, 11:35:24 AM1/16/08
to
On Jan 16, 10:11 am, "Chris P." <m...@chrisnet.net> wrote:
>
> Great ... another broken "upgrade".
>
> I'll take a look and see what I can figure out. Hopefully they didn't
> break it completely.
>

Thanks.

Chris P.

unread,
Jan 21, 2008, 6:50:30 PM1/21/08
to

The access violation is inside the filter,
qasf.dll!CWMWriterInputPin::GetAllocatorRequirements() + 0x4d bytes

The qasf.dll is updated as part of the SDK 11 install, so the bug appears
to be restricted to the DirectShow wrapper. I'll check to see if I have
access to the source code for this version.

babgvant

unread,
Jan 22, 2008, 11:15:43 AM1/22/08
to
On Jan 21, 5:50 pm, "Chris P." <m...@chrisnet.net> wrote:
>
> The access violation is inside the filter,
> qasf.dll!CWMWriterInputPin::GetAllocatorRequirements() + 0x4d bytes
>
> The qasf.dll is updated as part of the SDK 11 install, so the bug appears
> to be restricted to the DirectShow wrapper. I'll check to see if I have
> access to the source code for this version.
>
> --http://www.chrisnet.net/code.htm

> [MS MVP for DirectShow / MediaFoundation]

Thanks for the update.

How likely do you think it is that MS will address it? Do you think
it will be possible to get them to address the bug (asf writer doesn't
accept multichannel audio) that highlighted this one while they're at
it?

Chris P.

unread,
Jan 22, 2008, 3:23:36 PM1/22/08
to
On Tue, 22 Jan 2008 08:15:43 -0800 (PST), babgvant wrote:

> How likely do you think it is that MS will address it? Do you think
> it will be possible to get them to address the bug (asf writer doesn't
> accept multichannel audio) that highlighted this one while they're at
> it?

I don't have access to all the code so it's hard to say. It does look like
they attempted to update the WM ASF Writer for v11 to accept multi-channel
audio in the WAVEFORMATEXTENSIBLE form but I haven't made it work yet.

--

Damiox

unread,
Jan 25, 2008, 12:03:02 PM1/25/08
to
Sorry,

Could you kick this ASF out working ?
Is the seeking working too ?

Anybody could send me this ASF file in order to analize ?

Thanks
Damian

"babgvant" wrote:

> On Dec 19, 4:55 pm, "Chris P." <m...@chrisnet.net> wrote:
> > On Wed, 19 Dec 2007 13:40:49 -0500, Chris P. wrote:
> >
> > >> I had a go with the AudioTypeConverter filter, but checking the
> > >> MediaType on the output pin the formatType Guid is still that of
> > >> WaveEx i.e. 05589f81-c356-11ce-bf01-00aa0055595a. HOwver the subtype
> > >> is 00000001-0000-0010-8000-00aa00389b71 which looks like it should be
> > >> KSDATAFORMAT_SUBTYPE_PCM. However when I hook the pin up to the
> > >> ASFwriter it still won't do it. The profile definitely expects 16bit
> > >> 44.1Khz 5.1 and the source file is just that.
> >
> > >> Do I have to configure the filter via its interface to get it to work?
> > >> I had a look through the source code and got the feeling that was just
> > >> for future expansion.
> >
> > > Hmm. Let me make sure the correct source code is up there, as I also had a
> > > "template" audio filter. In the meantime try the binary download, I know
> > > that one works as people are using it.
> >
> > I checked the source code posted and it is correct although badly
> > commented. On the output pin the advertised wave format should look like
> > WaveFormatEx except the waveID will be 0xfffffffe and the cbSize = 22.
> >
> > However it unfortunately does not seem to be working with the ASF writer
> > correctly when I passed it my sample wave file. I ended up with 5
> > converters, an indeo audio decoder and an ACM Wrapper in between. I will
> > debug the format negotiation a little bit and see what is going on.
> >
> > --http://www.chrisnet.net/code.htm


> > [MS MVP for DirectShow / MediaFoundation]
>

> Thank you.
>

babgvant

unread,
Feb 5, 2008, 11:41:41 AM2/5/08
to
On Jan 22, 2:23 pm, "Chris P." <m...@chrisnet.net> wrote:
>
> I don't have access to all the code so it's hard to say. It does look like
> they attempted to update the WM ASF Writer for v11 to accept multi-channel
> audio in the WAVEFORMATEXTENSIBLE form but I haven't made it work yet.
>
> --http://www.chrisnet.net/code.htm

> [MS MVP for DirectShow / MediaFoundation]

Do you know if the WMF PG has a place to submit these kinds of issues,
or is it the sort of thing that requires a trudge through PSS?

Chris P.

unread,
Feb 5, 2008, 12:46:55 PM2/5/08
to
On Tue, 5 Feb 2008 08:41:41 -0800 (PST), babgvant wrote:

> Do you know if the WMF PG has a place to submit these kinds of issues,
> or is it the sort of thing that requires a trudge through PSS?

I've not seen WMF respond through any channel except for PSS. I think they
are kept locked up in the basement of building 50 and not allowed to
communicate with the outside world. I sent it to the DS folks I know but
they were at a loss.

--

babgvant

unread,
Feb 6, 2008, 10:44:12 AM2/6/08
to
On Feb 5, 11:46 am, "Chris P." <m...@chrisnet.net> wrote:
> I've not seen WMF respond through any channel except for PSS. I think they
> are kept locked up in the basement of building 50 and not allowed to
> communicate with the outside world. I sent it to the DS folks I know but
> they were at a loss.
>
> --http://www.chrisnet.net/code.htm

> [MS MVP for DirectShow / MediaFoundation]

c'est la vie. Thanks.

Chris P.

unread,
Feb 6, 2008, 12:12:05 PM2/6/08
to
On Wed, 6 Feb 2008 07:44:12 -0800 (PST), babgvant wrote:

> On Feb 5, 11:46 am, "Chris P." <m...@chrisnet.net> wrote:
>> I've not seen WMF respond through any channel except for PSS. I think they
>> are kept locked up in the basement of building 50 and not allowed to
>> communicate with the outside world. I sent it to the DS folks I know but
>> they were at a loss.
>>
>

> c'est la vie. Thanks.

I brought this up when I spoke to a PM today. He has a laundry list of
recently raised issues with this amongst them that he is going to try and
bring to the dev team. Doesn't mean it will get fixed, but if they can
give me an idea of what is happening then we might be able to develop a
workaround. It's also not likely to happen quickly, but I will update you
if I hear anything back.

--

babgvant

unread,
Feb 7, 2008, 10:09:27 AM2/7/08
to
On Feb 6, 11:12 am, "Chris P." <m...@chrisnet.net> wrote:
>
> I brought this up when I spoke to a PM today. He has a laundry list of
> recently raised issues with this amongst them that he is going to try and
> bring to the dev team. Doesn't mean it will get fixed, but if they can
> give me an idea of what is happening then we might be able to develop a
> workaround. It's also not likely to happen quickly, but I will update you
> if I hear anything back.
>
> --http://www.chrisnet.net/code.htm

> [MS MVP for DirectShow / MediaFoundation]

Excellent. Thanks.

0 new messages