68

I'm thinking about developing a streaming server and I have the following question, do over RTSP (example url: rtsp://192.168.0.184/myvideo.mpg) or RTP (example url: rtp://192.168.0.184).

As I have understood, an RTSP server is mainly used for streaming of files that already exist, ie, not live. RTP server is used to broadcast.

Somebody correct me if I'm wrong, am I right?.

What I want to develop a server to broadcast live content on the computer screen, that is, which is displayed at the time that is broadcast in streaming.

Lobo
  • 3,677
  • 6
  • 32
  • 62
  • 1
    Also, you may want to checkout (pun unintended :)) Apple's open source Darwin Streaming Server (to avoid reinventing the wheel - unless you have custom requirements not met by existing solutions). –  Nov 29 '10 at 11:58
  • @JP19 Does it work on Windows ? – Searush Oct 03 '12 at 21:15
  • is the RTP RUL right? do you need to specify the port number? – Albert Chen Jan 03 '15 at 05:50

6 Answers6

110

You are getting something wrong... RTSP is a realtime streaming protocol. Meaning, you can stream whatever you want in real time. So you can use it to stream LIVE content (no matter what it is, video, audio, text, presentation...). RTP is a transport protocol which is used to transport media data which is negotiated over RTSP.

You use RTSP to control media transmission over RTP. You use it to setup, play, pause, teardown the stream...

So, if you want your server to just start streaming when the URL is requested, you can implement some sort of RTP-only server. But if you want more control and if you are streaming live video, you must use RTSP, because it transmits SDP and other important decoding data.

Read the documents I linked here, they are a good starting point.

Krishna Oza
  • 1,215
  • 1
  • 19
  • 43
Cipi
  • 10,430
  • 9
  • 43
  • 59
  • :Thanks for your explanation.I m trying to stream audio in J2Me apps and I m new for protocols.I want to know whether we can send RTSP requests to RTP servers(Perhaps changes of port number would be needed from the client app.)You mentioned `you can implement some sort of RTP-only server` Does it mean that there are servers what can handle both rtp,rtcp? What are the servers(rtp,rtcp) we can use in our local machine for testing. – Débora Dec 25 '11 at 06:07
  • @Cipi , but must I use something (smtg like rtp server,tools, programs,etc) to make the computer stream anything? I mean if I want to stream, I get errors like this: http://stackoverflow.com/questions/12007882/ffmpeg-rtp-streaming-error – Searush Oct 03 '12 at 21:21
  • 1
    Cipi : Just curious to know whether we can actually pause a live stream and then hit play again. – Krishna Oza Dec 22 '15 at 15:28
18

AFAIK, RTSP does not transmit streams at all, it is just an out-of-band control protocol with functions like PLAY and STOP.

Raw UDP or RTP over UDP are transmission protocols for streams just like raw TCP or HTTP over TCP.

To be able to stream a certain program over the given transmission protocol, an encapsulation method has to be defined for your container format. For example TS container can be transmitted over UDP but Matroska can not.

Pretty much everything can be transported through TCP though.

(The fact that which codec do you use also matters indirectly as it restricts the container formats you can use.)

Krishna Oza
  • 1,215
  • 1
  • 19
  • 43
vbence
  • 19,252
  • 8
  • 61
  • 111
13

Some basics:

RTSP server can be used for dead source as well as for live source. RTSP protocols provides you commands (Like your VCR Remote), and functionality depends upon your implementation.

RTP is real time protocol used for transporting audio and video in real time. Transport used can be unicast, multicast or broadcast, depending upon transport address and port. Besides transporting RTP does lots of things for you like packetization, reordering, jitter control, QoS, support for Lip sync.....

In your case if you want broadcasting streaming server then you need both RTSP (for control) as well as RTP (broadcasting audio and video)

To start with you can go through sample code provided by live555

Community
  • 1
  • 1
Alam
  • 1,318
  • 13
  • 25
6

I hear your pain. I'm going through this right now (years later). From what I've learned, you can think of RTSP as a "VCR controller", the protocol allows you to specify which streams (presentations) you want to play, it will then send you a description of the media, and then you can use RTSP to play, stop, pause, and record the remote stream. The media itself goes over RTP. RTSP is normally implemented over a different socket or communication layer. Although it is simply a protocol, most often it's implemented by a server over a socket. For live streams, the RTSP stream you request is simply a name of a stream. It doesn't need to refer to a file on the server, the server's RTSP implementation can parse that stream, put together a live graph, and then provide the SDP (description) for that stream name. But, this is of course specific to the way the RTSP server has been implemented. For "live" streams, it's probably simpler to just use RTP, but you'll need a way to transfer the SDP from the RTP server to the client that wants to play that stream.

eric frazer
  • 1,216
  • 1
  • 10
  • 16
4

I think thats correct. RTSP may use RTP internally.

  • That is correct in most cases, there are cases where you can have something else replace Rtp in the protocol..... – Jay Mar 29 '13 at 07:27
-3

RTSP (actually RTP) can be used for streaming video, but also many other types of media including live presentations. Rtsp is just the protocol used to setup the RTP session.

For all the details you can check out my open source RTSP Server implementation on the following address: https://net7mma.codeplex.com/

Or my article @ http://www.codeproject.com/Articles/507218/Managed-Media-Aggregation-using-Rtsp-and-Rtp

It supports re-sourcing streams as well as the dynamic creation of streams, various RFC's are implemented and the library achieves better performance and less memory then FFMPEG and just about any other solutions in the transport layer and thus makes it a good candidate to use as a centralized point of access for most scenarios.

Jay
  • 3,017
  • 1
  • 22
  • 37
  • 1
    I think this is not an answer. – Lobo Mar 12 '13 at 08:40
  • I know for a fact me an Ciphi are right... we are saying the same thing! I think you can't take time to read and are head strong. – Jay Mar 12 '13 at 13:17
  • 3
    I think RTSP is actually not RTP. RTSP is defined in application layer while RTP is in transport layer in OSI model (http://www.tomax7.com/aplus/osi_model.htm). – Alston Feb 13 '14 at 09:50
  • Both are application level protocols, you must be talking about EIRGP or Reliable Transport Protocol. – Jay Oct 14 '14 at 16:54
  • Can somebody just write in one line that if i am encoding a video in ffmpeg and i want the live streaming of that video then am i in right direction of using RTSP server ? – Shilpi Agrawal Jul 16 '15 at 06:25
  • 6
    `if i am encoding a video in ffmpeg and I want the live streaming of that video then am i in right direction of using RTSP server` – Jay Jul 16 '15 at 19:03