Am I right in assuming that this is too old to start adding the ability to
encode to WMV to my program?
What is the minimum I would I need to update to, to add the ability to
encode to WMV ?
I would like to stick with VC++ 2003 for the time being if possible.
best,
Tuviah
> I'm currently developing using MFC in Visual C++ 2003 and
> a DirectX SDK from Feb 2005 (I think it was the last
> version to include the DirectShow SDK). I'm not sure
> about the platform SDK version but I guess this would
> have been supplied with VC++ 2003.
> Am I right in assuming that this is too old to start
> adding the ability to encode to WMV to my program?
No, it's not. You need the "Windows Media Format" SDK and
the "Windows Media Audio and Video Codec Interfaces" SDK.
You need to use v9.0 or v9.5 of the WMF SDK I think.
That will allow you to encode using any version of the WMV
codecs, including v11 (as long as you install the new
version of the runtime).
> What is the minimum I would I need to update to, to add
> the ability to encode to WMV ?
>
> I would like to stick with VC++ 2003 for the time being
> if possible.
However, why don't you upgrade your SDKs? The DirectShow SDK
has simply been moved to the Platform/Windows SDK. The
latest version of the PSDK to support VC++2003 is the one
for Windows Server 2003 R2
(http://www.microsoft.com/downloads/details.aspx?FamilyID=0baf2b35-c656-4969-ace8-e4c0c0716adb),
which should contain the DirectShow SDK.
However, if you can, you should upgrade to VC++2008SP1 and
the WinSDK for Win7 (which includes both DirectShow and
WindowsMedia). Notice that the express edition of VC++2008
is free (but you loose MFC and ATL if that is important to
you).
--
// Alessandro Angeli
// MVP :: DirectShow / MediaFoundation
// mvpnews at riseoftheants dot com
// http://www.riseoftheants.com/mmx/faq.htm
Thanks. The MSDN page for ASF Writer says it is a "wrapper for the writer
object provided with the Windows MediaT Format SDK", so presumably I would
have to install the Windows Media Format SDK before I would be able to use
the ASFWriter? And the "Windows Media Audio and Video Codec Interfaces" SDK
too ?
The page also says "This filter provides the only way to create Microsoft�
Windows MediaT Audio and Windows Media Video files in Microsoft DirectShow".
In practice is this the only approach that everone uses to write Windows
Media Video and Audio files from frames served through a DirectShow filter
graph, or are there other ways of doing this - perhaps better?
> You need the "Windows Media Format" SDK and the "Windows Media Audio and
> Video Codec Interfaces" SDK. You need to use v9.0 or v9.5 of the WMF SDK I
> think.
Is this version dictated by compatability with the version of VC++ I'm
using?
I'm obviously going to have a lot of reading up to do, and it's not clear
where to start. Does anyone have a link to the best starting place in the
MSDN documentation, or perhaps a nice quickstart guide?
I found some documentation for "Windows Media Format 11 SDK", but Alessandro
said I would have to use version 9 or 9.5
http://msdn.microsoft.com/en-gb/library/dd757738(VS.85).aspx
In the short term I would like to get up to speed with just the parts I'd
need to know to be able to add a video and audio WM encoder and file writer
to the end of my filter graph (instead of the existing AVI Mux and File
Writer), and tweak the encoding bitrate and other encoding parameters, so if
there's a subset of the docs which just deal with that, that would be great.
> However, why don't you upgrade your SDKs? The DirectShow SDK has simply
> been moved to the Platform/Windows SDK. The latest version of the PSDK to
> support VC++2003 is the one for Windows Server 2003 R2
> (http://www.microsoft.com/downloads/details.aspx?FamilyID=0baf2b35-c656-4969-ace8-e4c0c0716adb),
> which should contain the DirectShow SDK.
Thanks for letting me know. My current setup seems to work fine, and I've
been reluctant to fiddle around with it when it's not broken. Would I also
need to install the DirectX SDK, and if so what version would be compatible
with the above Platform SDK? When I installed the old DirectX SDK it was
because it contained the DirectShow SDK, and it was never clear to me
whether DirectShow development actually needed the DirectX parts.
I don't suppose there is a handy table which ties all of these dependancies
together, so that you can tell what versions of which SDKs you need for any
particular version of VC++ ?
> However, if you can, you should upgrade to VC++2008SP1 and the WinSDK for
> Win7 (which includes both DirectShow and WindowsMedia). Notice that the
> express edition of VC++2008 is free (but you loose MFC and ATL if that is
> important to you).
I definately need MFC so the express edition would not help. I may just wait
until Visual Studio 2010 is released.
> Thanks. The MSDN page for ASF Writer says it is a
> "wrapper for the writer object provided with the Windows
> MediaT Format SDK", so presumably I would have to install
> the Windows Media Format SDK before I would be able to
> use the ASFWriter? And the "Windows Media Audio and Video
> Codec Interfaces" SDK too ?
You should understand that the SDK only contains docs,
samples and .h/.lib files. It does not contain the runtime,
which is part of Windows. Of course, using the runtime
without the WMF SDK is limited since you don't have the .h
files for the non-standard DirectShow interfaces.
The layering of the WMF runtime is the following:
1. on top you have the WMASFWriter filter for DirectShow
(qasf.dll), which wraps the WMWriter oject in the WMF
runtime (wmvcore.dll)
2. the WMWriter (and thus the WMASFWriter) is an ASF muxer
and, by default, it also wraps the WM encoders
3. at the bottom you have the WM encoders, however you
usually do not use them directly but let the WM[ASF]Writer
use them for you
Layer 1 (using the WMASFWriter as muxer or muxer+encoder)
requires the DS SDK and the WMF SDK for advanced features.
One of those features is generating an encoding profile,
which you will probably need.
http://msdn.microsoft.com/en-us/library/dd757032.aspx
Layer 2 (using the WMWriter as muxer or muxer+encoder) only
requires the WMF SDK.
http://msdn.microsoft.com/en-us/library/dd758048.aspx
Layer 3 (using the WM encoders directly) requires the DS
SDK, since the encoders are DMOs. It also requires the WM
A/V SDK to use some advanced features of the encoders, but
probably it is not your case since you plan on using the
WMASFWriter filter.
http://msdn.microsoft.com/en-us/library/dd757732.aspx
Layers 1 and 2 have the following in common:
[profiles]
http://msdn.microsoft.com/en-us/library/dd758039.aspx
[interlaced video]
http://msdn.microsoft.com/en-us/library/dd743807.aspx
[anamorphic video]
http://msdn.microsoft.com/en-us/library/dd758036.aspx
[metadata]
http://msdn.microsoft.com/en-us/library/dd758051.aspx
[markers]
http://msdn.microsoft.com/en-us/library/dd743937.aspx
> The page also says "This filter provides the only way to
> create Microsoft� Windows MediaT Audio and Windows Media
> Video files in Microsoft DirectShow". In practice is this
> the only approach that everone uses to write Windows
> Media Video and Audio files from frames served through a
> DirectShow filter graph, or are there other ways of doing
> this - perhaps better?
There are much more complicated ways, but using the
WMASFWriter covers most scenarios, even advanced ones.
>> You need the "Windows Media Format" SDK and the "Windows
>> Media Audio and Video Codec Interfaces" SDK. You need to
>> use v9.0 or v9.5 of the WMF SDK I think.
>
> Is this version dictated by compatability with the
> version of VC++ I'm using?
Yes.
> I'm obviously going to have a lot of reading up to do,
> and it's not clear where to start. Does anyone have a
> link to the best starting place in the MSDN
> documentation, or perhaps a nice quickstart guide?
The docs for the WM filters are well hidden but I gave the
starting point above.
> I found some documentation for "Windows Media Format 11
> SDK", but Alessandro said I would have to use version 9
> or 9.5
The SDK didn't change much between v9.5 and v11. Mostly the
docs were just updated to include info on the new codecs. I
suggest you use the docs from v11 but the .h/.lib from v9.5.
> In the short term I would like to get up to speed with
> just the parts I'd need to know to be able to add a video
> and audio WM encoder and file writer to the end of my
> filter graph (instead of the existing AVI Mux and File
> Writer), and tweak the encoding bitrate and other
> encoding parameters, so if there's a subset of the docs
> which just deal with that, that would be great.
Unless you want to use the encoders on your own for some
reason, the WMASFWriter will use them for you, so you only
need the latter in your graph:
1. co-create and add the WMASFWriter to the graph
2. create a WMProfile and configure the WMASFWriter with it
(you need WMF to create the profile)
3. configure the output file
4. connect the pins
5. write the metadata
6. run the graph
The dshow\DSCopy sample in the WMF SDK will show you how to
use WMASFWriter. Q20 in my FAQ (link in my sig) will show
you how to generate a profile and so will the WMGenProfile
and UncompAVIToWMV samples in the WMF SDK.
> it when it's not broken. Would I also need to install the
> DirectX SDK, and if so what version would be compatible
> with the above Platform SDK? When I installed the old
> DirectX SDK it was because it contained the DirectShow
> SDK, and it was never clear to me whether DirectShow
> development actually needed the DirectX parts.
DS doesn't need DX except to use some advanced features of
the renderers, so the DX SDK isn't really a requirement. In
any case, you can install the version of the DX SDK the was
realeased right after the Platform SDK. IIRC, the newer PSDK
that includes DS also includes the possibly useful bits of
DX.
> I don't suppose there is a handy table which ties all of
> these dependancies together, so that you can tell what
> versions of which SDKs you need for any particular
> version of VC++ ?
This stuff comes from Microsoft, they don't even believe in
version numbers :-)
One quick question - I just noticed on the home page for "Windows Media
Format 11 SDK" it says "New for this release is the Windows Media Video 9
Advanced Profile codec, which provides optimizations for broadcast video."
I would sometimes need to encode high definition 1920x1080 video frames, and
perhaps do deinterlacing aswell if the encoder is capable of doing that. The
statement above might mean that version 11 of the SDK is needed to encode
high definition video - is that correct? If it is, then I might be unable to
encode high def video if I am restricted to using version 9.0 or 9.5 of the
SDK. In other words, are there any restrictions to the type of video I can
encode in version 9.0/9.5 of the SDK versus version 11 ?
> statement above might mean that version 11 of the SDK is
> needed to encode high definition video - is that correct?
> If it is, then I might be unable to encode high def video
> if I am restricted to using version 9.0 or 9.5 of the
> SDK. In other words, are there any restrictions to the
> type of video I can encode in version 9.0/9.5 of the SDK
> versus version 11 ?
You need v11 of the runtime, not v11 of the SDK. v11 of the
SDK includes the runtime installer (just use 7-Zip or WinRAR
to unpack the SDK installer to extract the redist
installer), but the runtime is also installed by e.g.
WindowsMediaPlayer.
At any rate, the statement you quoted is incorrect: the WMVA
codec was available before, v11 of the runtime only contains
an updated version which is better and also supports a VC-1
compliant bitstream (WVC1). The API didn't change and any
app compiled with v9.x of the SDK will magically see this
improved codec (e.g. WindowsMediaEncoder9). At most, what
you will need is the GUID subtype definition, that is a
single line you can copy from one of .h files in the v11 SDK
(which jusr has the value FOURCCMap(*(DWORD*)"WVC1")).
At any rate, all incarnations of the WMV codec should be
able to suppord HD, with different degrees of quality.
If you're serious about HD however, you shouldn't be using
the WMF encoders at all but the new VC-1 Encoder SDK:
http://www.microsoft.com/resources/mediaandentertainment/vc-1encodersdk.mspx
The VC-1 Enc SDK has a completely different C++-based API
and it provides the encoder only. To use it in DirectShow,
you will need to wrap it into a DMO or transform filter. You
will still need the WMASFWriter to mux the VC-1 stream into
an ASF file (but configured in bypass mode so that it only
muxes).