Http://blog.sina.com.cn/u/4841fc61010004bk
Bitrate-"bit rate" is an attribute of a media file. Generally, a media file has several streams-"streams", such as audio streams and video streams, the bit rate here refers to the superposition of the bit rate between the audio stream and the video stream.
Environment: VC header file: # include "wmsdk. H "in VC's" tools-> options (options) ", set the path to install wmfsdk9 accordingly, for example, C:/wmsdk/wmfsdk9/include, C: /wmsdk/wmfsdk9/lib (using Windows Media Format SDK 9 related functions) more complete settings, can refer to: http://lenux.blogchina.com/3936516.html (help a lot, huh, huh, like the following: hresult hR = coinitialize (0 );
Iwmsyncreader * m_psynreader;
Iwmprofile * ppprofile;
DWORD dwcount = 0;
DWORD totalbitrate = 0; HR = wmcreatesyncreader (null, wmt_right_playback, & m_psynreader );
HR = m_psynreader-> open (L "C: // 2.wmv"); m_psynreader-> QueryInterface (iid_iwmprofile, (void **) & ppprofile );
HR = ppprofile-> getstreamcount (& dwcount );
If (succeeded (HR ))
{
For (word w = 0; W <= dwcount; W ++)
{
Iwmstreamconfig * pstrmconf = NULL;
HR = ppprofile-> getstream (W, & pstrmconf );
If (succeeded (HR ))
{
Guid guidst;
HR = pstrmconf-> getstreamtype (& guidst );
If (succeeded (HR ))
{
If (guidst = wmmediatype_video)
{
DWORD videobitrate;
HR = pstrmconf-> getbitrate (& videobitrate );
Totalbitrate = totalbitrate + videobitrate;
}
If (guidst = wmmediatype_audio)
{
DWORD audiobitrate;
HR = pstrmconf-> getbitrate (& audiobitrate );
Totalbitrate = totalbitrate + audiobitrate;
}
}
Pstrmconf-> release ();
}
}
} Several notes: 1.hr = m_psynreader-> open (L "C: // 2.wmv"); read the instructions in wmfsdk9:
Hresult open (
Const wchar *
Pwszfilename
);
Therefore, if it is not compiled in unicode format, you must first convert ANSI to Unicode,
For example, convert cstring STR to lpcwstr pcwstr
Cstring STR = _ T ("teststr ");
Uses_conversion;
Lpwcstr pwcstr = a2cw (lpcstr) Str); 2. hresult hR = coinitialize (0); for the use of COM, The coinitialize process is required. If it has been initialized before use, you can skip this step.