Warm tip: This article is reproduced from serverfault.com, please click

RTSP and RTP for streaming from an IP Camera

发布于 2021-01-14 00:03:38

I'm sorry if this is a dumb question. I've searched the web and can't find a direct answer.

I have a simple application in c# that opens an RTSP session and sends the appropriate commands like DESCRIBE, SETUP, etc to control an RTP data stream.

My questions is this: does the TCP session (for the RTSP communication) have to stay open while streaming the data over RTP? Without going into details as to why, I'd like to be able to close the RTSP session after the RTP streaming is setup.

Questioner
BBridges
Viewed
0
eschmid 2021-02-06 00:22:51

The short answer is yes you must keep the rtsp socket open.

If the stream is over TCP the RTP packet travels over the socket of the RTSP session. If the stream is over UDP the socket is used by the server to know if it should keep sending packet to the client because the UDP packet transmission does not have any feedback if the client is still alive.

Edited:

I think the answer marked correct is actually incorrect. In general, the cameras implement the RTSP protocol version 1 not version 2. In the 10 years that I have of experience in video surveillance systems I have found that several models of cameras stop sending RTP packets after closing the RTSP session socket .