We are resetting the encoder when the aspect ratio changes. We need the updated sps/pps before we call MFXVideoENCODE_Init, so MFXVideoENCODE_GetVideoParam isn't useful as it returns the current sps/pps and not the future one. We tried mfxExtCodingOptionSPSPPS with MFXVideoENCODE_Query but it fails with various errors, depending if we set mfxExtCodingOptionSPSPPS in the input and/or output mfxVideoParam. We could have a separate (joined) session just to get the sps/pps, but it seems heavyweight. How do you get sps/pps from mfxVideoParam without initializing anything?
Is your pipeline encode only, or does it include decode?
If you've got a transcode pipeline, this thread may provide some insights: https://software.intel.com/en-us/forums/intel-media-sdk/topic/535185
It may be possible to handle aspect ratio changes without parsing future SPS/PPS if the change can be seen at decode. Does this apply in your case?
No, our pipeline is encode only. The thread you link was about resizing frames to square pixels. We want to support 720x480 4:3 and 720x480 16:9. Both cases have non-square pixels.
In an encode-only pipeline as you've described the only way to retrieve SPS/PPS header info is to first initialize the encoder.
I'd like to understand a bit more about your use case. If it is possible to insert an IDR frame you can change aspect ratio at the same time, or you could restart the pipeline with a new aspect ratio by updating mfxVideoParam (as you would need to do to init with a new SPSPPS). Do you need to do something more than these approaches allow? BTW the extra session shouldn't have a big performance impact but it will use a bit of extra memory.
We need the future spspps to negotiate type change in our homegrown directshow filters. For now we hacked the negotiation, flush all samples, update mfxVideoParam and then reset the encoder. The aspect ratio changes a few frames before correct frame for avc. Maybe that is fixed inserting an IDR frame. Do you have doc/samples?