用Java实现RTSP媒体服务器

发布于 2024-10-26 04:32:59 字数 333 浏览 1 评论 0原文

我正在尝试用java实现一个简单的RTSP服务器,它将使用android手机作为接收客户端。我在互联网上搜寻答案并多次返回该网站。通过这个我发现JMF本身并不支持服务器端的RTSP,并且java必须使用NIO框架(例如Netty,Xuggler,Mina等)进行扩展。我唯一的问题是,在搜索这些网站的文档后,我有没有找到任何关于如何实现 RTSP 的基本示例。

我的问题是:是否有人遇到过这个问题并解决了它,如果是的话,请给我指出一些有用的源代码或文档。记住这一点,已经查看了该网站上的每个相关线程,并对大多数链接进行了跟踪,但没有任何效果。我对java并不陌生,我了解所有流协议,但我对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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

很难回答你的问题......我只会给你一些基本的建议:
- 从一些 POC 开始你的工作,以获得对 Java 网络编程的信心
- 阅读 Java 世界中可用的几个 TCP/IP 开源服务器实现的一些源代码(Jetty/Tomcat/Jboss 和其他几个)
- 尝试认为您的架构符合开放关闭原则(能够添加对新流编解码器的支持等)
- 尝试以所需数量的并行用户会话为目标,服务器大小根据您的限制并使用合同中规定的网络带宽

客户端不会产生太大影响,RTSP 似乎是类似 REST 的协议,因此您不需要不必维护用户上下文...只需回答传入的请求,看起来非常简单的情况...协议似乎不是很丰富(命令集非常有限)...尝试阅读其中之一的一些源代码可用的不同客户端。我可以建议您获取标准 Linux 播放器之一的源代码:

  1. VLC
  2. mplayer
  3. xine

您可能会在这些产品中找到非常有用的代码。
我想那些已经实现了商业产品的人将无法给你他们的反馈,所以使用开源软件!

华泰
杰罗姆

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

把梦留给海 2024-11-02 04:32:59

我认为 JMF 包含 RTP / RTCP 类的原因是这些是媒体协议 - 即这些协议描述了媒体如何通过 IP 进行流传输以及如何报告流质量(分别)。

RTSP 是一种控制协议 - 它用于设置媒体流。因此,这是 JMF 管理的媒体流之上的一层。您可以在您喜欢的任何通道中交换 RTSP 消息,然后使用交换的信息来建立您的媒体流。

尝试在 google code 项目中搜索 RTSP 实现,看起来有一些。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文