Search code examples
wiresharkh.264rtp

Finding GOP structure and length


I set up a video stream and captured its packets(H264 over RTP). Looking at the Wireshark capture(decoded with type 96), I need to figure out the format of the GOP and the length of it. Problem is I can't tell which frame is I/P/B. Can I do this by looking at the Wireshark capture or do I need some sort of extension?


Solution

  • While you can get the NAL unit type of each frame quite easily by looking at the H.264 RTP payload format, I would recommend rather using a tool such as ffprobe to do the work for you:

    ffprobe -show_frames  -rtsp_transport tcp "<rtsp URI>"  | grep -E 'pict_type' 
    

    which will output something like

    pict_type=I

    pict_type=P

    pict_type=P

    pict_type=P

    In my example I use an RTSP stream but you should be able to adapt this to the RTP stream.