IConfigureVideoEncoder with H.264 encoder in MSDK 2012
I'm successfully using IConfigureVideoEncoder from C# to change the dimensions of the output stream from the H.264 encoder. But a bunch of the fields within the Params structure seem to be underdocumented, so here are a list of questions:
Q1. I am calling IConfigureVideoEncoder.SetParams() after the input is connected, but before the output is connected. Is this the best time?
Q2. Here are the default values in Params:
level_idc: LL_AUTOSELECT preset: 3 ps_control: all zeros target_usage: 7
I would guess that setting some of these values will alter some of the others, but the the interactions are opaque to me.
Q2a. What is target_usage? Q2b. If ps_control is all zeros does this mean "codec, you figure it out?" Q2c. Because preset is 3 (PRESET_FAST), does this mean none of my other settings will be accepted unless I set preset to PRESET_USER_DEFINED?
Q3: Does setting these values affect codec settings stored in the registry?
Params structure fields are ducumented via commetatriesin the header file where defined. Also they mostly match mfxVideoParam fields so their definitions can be found in Media SDK manual.
Here are the answers to your questions:
1) This time is good. You should not call the method before input is connected as some parameters may be overwritten during connection in CheckInputType method.
2) a) target usage parameter has the same meaning as mfxVideoParam::mfx::TargetUsage, i.e. tradeoff between speed and quality of encoding, having other parameters, such as bitrate, fixed. Params::Preset is a similar but higher level tradeoff but having only stream resolution fixed - bitrate and others are tuned.
2) a) Yes, zero parameters will be passed as mfxVideoParam fields and this means codec will choose its defaults.
2) c) This is a correct assumption - choose Preset=USER_DEFINED to make sure all of your settings take effect. We will document this limitation explicitly in the next release.
3) Yes, settings will be stored in registry (see StoreEncoderParams)