For some reason FFmpeg 5.1.x reverted part of the changes made in 5.0.x on AVCodec. This fix decoding issues with it.