How to recognize I and P frames while reading an encoded video

While reading bytes from the encoded video how can I know is it for I frame or P frame?

Anyone, please tell me how to identify this?