I have the code as follows
av_open_input_file("rtsp://.....);
while(av_read_packet() >= 0) {
// do something with the packet
}
The problem is I am only able to receive, say, 100-200 packets and then av_read_packet returns EOF error. So I have to reconnect and start getting frames again.
I wonder if I can set some options to av_open_input_file()
(or maybe use some other API) so that the connection wouldn't drop that often.
Thank you
Since you using RTSP, you're probably using RTP. Is this over UDP or TCP? One thing that could be occurring is that your RTSP session is timing out. If FFMPEG is not sending RTCP receiver reports, the RTSP server could be terminating the connection? This is all speculation though, use a network sniffer such as wireshark to see what is happening.