问题
I am running the CapWMV sample application of DirectShow.NET.
It is loading a very low quality profile in Capture.cs:
// Windows Media Video 8 for Dial-up Modem (No audio, 56 Kbps)
// READ THE README for info about using guids
Guid cat = new Guid(0x6E2A6955, 0x81DF, 0x4943, 0xBA, 0x50, 0x68, 0xA9, 0x86, 0xA7, 0x08, 0xF6);
The readme says
if you MUST use guids, you can find them defined in %windir%\WMSysPr9.prx.
But when I load another profile, if fails, presumably because I am not connecting an audio stream, as the WindowsMedia Readme doc explains:
The easiest (the one used most commonly in the samples) is to use IWMProfileManager::LoadProfileByID. This method takes a Guid, which gets matched with the entries in %windir%\WMSysPr9.prx, and is used to specify various parameters of the output (BPS, video size, etc).
If the profile is configured with 2 streams (ie Audio & video), you MUST connect both an audio and a video stream to the writer, or the writer will fail to write.
As I'm assuming I can't load a profile from a file with DirectShow.NET, I must load a better profile from WMSysPr9.prx (by a Guid) and connect an audio stream.
How would I go about doing that connection in this sample?
回答1:
GUID based "system" profiles are deprecated. They are predefined Windows Media 8 profiles which you can reference by GUID only instead of building the entire profile from pieces. Windows Media 9 did not offer any presets so you are supposed to create an empty profile and add streams there settings them up.
System Profiles:
There are no predefined system profiles that use the Windows Media 9 Series codecs. You can create your own Windows Media 9 Series profile by using a version 8 profile as a starting point. For more information, see Reusing Stream Configurations.
MSDN guides you in profile creation here:
The basic steps in creating and/or modifying profiles are:
- Create an empty profile, or load an existing profile to edit.
- Configure each of the streams, if required, based on supported profile data retrieved from the codec that will be used to encode the stream.
- Configure mutual exclusion, if needed.
- Configure bandwidth sharing, if needed.
- Set the priority of the streams in the file, if required.
You can find a code snippet here. It is C++, but conversion into C# would be pretty straightforward.
来源:https://stackoverflow.com/questions/20074243/directshow-net-sample-load-a-better-profile