Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Implementing RTSP media server in Java

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

like image 748
user673090 Avatar asked Mar 23 '11 13:03

user673090


2 Answers

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

like image 143
romje Avatar answered Nov 04 '22 23:11

romje


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.

like image 45
vladimir e. Avatar answered Nov 05 '22 00:11

vladimir e.