Implementing RTSP media server in Java
Asked Answered
J

2

8

I am trying to implement a simple RTSP server in java that will use an android handset as the receiving client. I have trawled the internet for answers and have been returned to this site many times. Through this I have found out that JMF does not natively support RTSP on the server side and that java must be extended using a NIO framework such as Netty, Xuggler, Mina etc. My only problem is that after searching the documentation for these sites I have not found any basic examples of how RTSP can be implemented.

My question is: Has any body had this problem and resolved it, and if so can you please point me towards some helpful source code or documentation. Bearing this in mind have already looked every related thread on this site and followed up on most links without any avail. I am not new to java and I understand all the streaming protocols but I am new to streaming implementations in java.

Thank you

Jamestown answered 23/3, 2011 at 13:20 Comment(4)
I dont understand the problem. You don't know how to implement RTSP? RTSP is same as HTTP. It is TEXT BASED, and there are TEXT requests and TEXT responses. You should implement the server same as any other server (multi threaded). Here: ietf.org/rfc/rfc2326.txt you can find all you need (all requests, all responses) and here tools.ietf.org/html/rfc4566 you can see how to build up SDP message... But I don't see whats the problem? Can you be more specific? What do you want to stream?Sojourn
Hi, cheers for responding. I want to stream video and audio in the set formats that android OS allow. I have already read the RFC for RTSP and understand how the protocol works. When I was fiddling around with Java Media Frame I found there are set classes that control RTP and RTCP sessions but nothing for RTSP. I also understand that RTSP can used with various other protocols such as HTTP but I am specficially looking for RTP over UDP as I beleive it will suit the streaming best. I really just want to know a means of succesfully servering video and audio to RTSP clients using java.Jamestown
So why in java? Why not use for example Darwin streaming server?Fabrienne
Do you realize that VLC media player can be a streaming server in various stream protocols like RTSP, UDP, HTTP, MMS? A few Java projects have applied the VLC engine (libVLC library and plugins used by VLC media player) in Java like VLCJ.Gutenberg
E
3

it's very hard to answer to your question... I will just give you some basic advices: - start your job with a little POC to gain confidence with Java network programming - read some source code of the several TCP/IP Open Source servers implementations available in the Java World (Jetty/Tomcat/Jboss and several others) - try to think your architecture to be compliant with the Open Close Principle (being able to add support for new streams codecs and so on) - try to target a desired volume of parallel user sessions running with a server sized following your constraints and using the network bandwidth as stated in your contract

The client won't have much impact , RTSP seems to be a REST like protocol so you don't have to maintain user context...Just answer to incoming requests, very simple case it seems...The protocol seems not be very rich (very restricted set of commands).... Try to read some source code for one of the different clients available.I can advise you to fetch source code for one the standard Linux players:

  1. VLC
  2. mplayer
  3. xine

you may find very helpful code in those products.. I guess that people who have implemented commercial products won't be able to give you their feedbacks so use open source software!!!

HTH Jerome

Excavation answered 2/3, 2012 at 8:45 Comment(0)
G
2

I think the reason that JMF contains classes for RTP / RTCP is that these are media protocols - i.e. these protocols describe how media is streamed over IP and how the stream quality is reported (respectively).

RTSP is a control protocol - it is used to set up the media streams. So this a layer above the media streams managed by JMF. You can exchange RTSP messages in whatever channel takes your fancy and then use the exchanged information to establish your media stream.

Try searching google code projects for RTSP implementations, looks like there are a few there.

Griner answered 5/3, 2012 at 10:33 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.