I'm working with RTMP. I need to write a program that captures RTMP packets, parse it and save RTMP video in flv container. For this purpose i need SPS and PPS which sent in the stream begin. But this data may sent in different streams. For examle:

1. SPS and PPS sent in stream 6 and video data sent in stream 7.
2. SPS,PPS and video data comes in stream 7.

How do I know which stream belongs to SPS and PPS if i have 3 video streams and only 1 stream which contain SPS and PPS?