I working with multimedia for a lot of years.
There are 2 microsoft ways to encode mpeg-2 one is using the separate video and audio encoders (also provided by Microsoft) and usage of Muxer with embedded audio and video encoders.
Here is the issues:
The microsoft mpeg-2 video encoder (same issues as I checked with audio):
- the bitrate changes not available I actually try to modify most common options - no luck.
- timestamps are broken - if you use the encoding from capture device or other source who handle the delivering timing this ecoders are works - otherwise forget abt them (the time stamp they produce is the dts only and not pts) even if you use your own muxer system you will get a lot's of issues with that.
The Mpeg-2 encoder with muxing embedded.
Works properly for audio and video input.
- the issue is that it can provide NULL as format block - your output filter should takes care of that.
- once I need to handle decoding h.264 and encode into mpeg-2 it works proper mostly with usage of Microsoft DTV Video Decoder filter for decoding video (Note: this filter is also not good - lot's of reasons) - actually some decoders were not handled NULL format.
Configuring encoder - for m - no luck.
Example the way you can try to :
if (m_pMpeg2Muxer)
{
ICodecAPI * pCodecAPI;
if (SUCCEEDED(m_pMpeg2Muxer->QueryInterface(IID_ICodecAPI,(void**)&pCodecAPI)))
{
_variant_t _value;
if (m_lVideoBitrate > 0)
{
_value = m_lVideoBitrate;
if (FAILED(pCodecAPI->SetValue(&CODECAPI_AVEncCommonMeanBitRate,&_value)))
{
m_lVideoBitrate = 0;
}
}
if (m_lVideoBitrate <= 0)
{
if (SUCCEEDED(pCodecAPI->GetDefaultValue(&CODECAPI_AVEncCommonMeanBitRate,&_value)))
{
m_lVideoBitrate = _value;
pCodecAPI->SetValue(&CODECAPI_AVEncCommonMeanBitRate,&_value);
}
}
pCodecAPI->Release();
}
}
return NOERROR;
Suggestions: not use the Microsoft Mpeg-2 stuff if you want to handle the all properties of encoding.
Regards,
Sonic.