It is unreliable, especially when the stream codec context is not the encoding context. Use the codec descriptor properties instead.