Incorrect dynamic aspect ratio when decoding an H.264 elementary stream.
I have an H.264 elementary stream file which contains (picture) aspect ratio changes (from 4/3 to 16/9, then back to 4/3). (These values are stored in the VUI part of the SPS). The resolution of the stream does not change.
I'm trying to track the aspect ratio changes at output level, i.e from the output surface returned by DecodeFrameAsync. I was hoping to get the aspect ratio from mfxFrameSurface1::Info::AspectRatioW/H, but it seems these values, although correct for the first frames, never get updated when the input aspect ratio changes. I tried to get the aspect ratio using GetVideoParam, same story : the returned values never changes once initialized.
It seems the decoder is correctly getting the aspect ratio at the beginning of the stream, but does not see aspect ratio changes. Is it a known issue? Is dynamic aspect ratio supposed to be supported?
At the moment, I'm able to detect aspect ratio changes by manually parsing the SPS (returned by GetVideoParam), but it seems the returned SPS does not refer to the next picture returned by DecodeFrameAsync, but to the last parsed SPS.
Actually, I'm having the same issue (i.e Info::AspectRatioW/H not updated) with an MPEG2 Video input, except that in the MPEG2 case, the above workaround (i.e parsing the sequence_header) seems to achieve frame-accurate results.
I'm using the following version of the Intel Media SDK : Version 3.5.811.41085 I got the issue with both modes : MFX_IMPL_SOFTWARE and MFX_IMPL_HARDWARE.
Yes, I believe you are correct in that the AspectRatio parameters does not get updated dynamically. But as you say parsing the header manually should work. I do find it a bit strange that the parsed SPS data does not line up with decoded frame.
Would you be able to share your stream so that we can try to reproduce your environment?
I will also look into if there is anything we can do to also convey dynamic aspectratio changes directly in the mfxVideoParam structure.