天天看点

android rstp服务器,将实时Android网络摄像头视频上传到RTP/RTSP服务器

您的整体方法听起来正确,但您需要考虑几件事情。

So I would like to program an application where the user can record a video and instantly (live) upload the video to a RTP/RTSP Server.

>我假设您要上传到RTSP服务器,以便可以将内容重新分发给多个客户端?

>如何处理RTP会话的信令/设置

RTSP服务器?您需要以某种方式通知RTSP服务器

将上传现场媒体,以便它可以打开相应的

RTP / RTCP套接字等

>你将如何处理身份验证?多个客户端设备?

My research so far is that I have to write the video on recording to a local socket rather than to a file, because the 3gp files if written to a file cannot be accessed, until finalized (when the video is stopped and the header information have been written to the video about length and others).

通过RTP / RTCP实时发送帧是正确的方法。当捕获设备捕获每个帧时,您需要对其进行编码/压缩,并将其发送到套接字上。 3gp,如mp4,是用于文件存储的容器格式。对于实时捕获,不需要写入文件。唯一这样做是有道理的。在HTTP Live Streaming或DASH方法中,在将媒体写入传输流或mp4文件之前,先通过HTTP服务。

When the socket receives the continuous data, I will need to wrap it into a RTP packet and send it to the remote server. I possibly will also have to do basic encoding first (which is not so important yet).

我不同意,编码非常重要,否则你很可能永远不会发送视频,而您将不得不处理诸如成本(超过移动网络)等问题,以及依赖于分辨率和帧率的大量媒体。 。

Does anybody have any idea, if this theory is correct so far. I would also like to know if someone could point me to a few code-snippets of similar approaches, especially for sending the video on the fly to the server. I am not sure yet how to do that.

以spydroid开源项目为起点。它包含许多必要的步骤,包括如何配置编码器,封装到RTP,发送RTCP以及一些RTSP服务器功能。 Spydroid设置一个RTSP服务器,因此媒体被编码并发送一次RTSP客户端(如VLC)用于设置RTSP会话。由于您的应用程序是由想要将媒体发送到服务器的手机用户驱动的,所以您可能需要考虑使用另一种方式来启动发送,即使您向服务器发送某种消息,例如设置RTSP会话,如spydroid 。