上传现场的Andr​​oid摄像头视频,RTP / RTSP服务器摄像头、现场、上传、服务器

2023-09-05 00:17:44 作者:追梦寻缘

我已经做了适当的研究,但仍缺乏对的事情,我想实现的信息。

I have already done proper research, but still lack information on the thing I would like to achieve.

所以,我想编写一个应用程序,用户可以录制视频,并立即(活)将视频上传到一个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. The server side will not be a problem. The thing I am unclear about is how to achieve this on the phone-side.

我的研究,到目前为止,是我必须写在记录到本地套接字,而不是到一个文件中的视频,因为如果写入文件的3GP文件无法访问,直到完成(当视频被停止,标题信息已被写入到约长度及其他)的视频

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分组,并将其发送到远程服务器。我可能还必须先做好基本的编码(这是不那么重要的还)。

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).

没有任何人有任何想法,如果这个理论是正确为止。 我也想知道,如果有人可以点我到几个code-片段的类似的方法,特别是对于在飞行到服务器发送视频。我还不确定该怎么做。

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.

非常感谢你和问候

推荐答案

您的总体方法听起来很正确的,但也有几件事情你需要考虑的问题。

Your overall approach sounds correct, but there are a couple of things you need to consider.

所以,我想编写一个应用程序,用户可以录制视频,并立即(活)将视频上传到一个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插座等。 您将如何处理身份验证?多个客户端设备?

I'm assuming you want to upload to an RTSP server so that it can redistribute the content to multiple clients? How will you handle the signaling/setup of the RTP session to the RTSP server? You need to notify the RTSP server somehow that a user is going to upload live media so that it can open the appropriate RTP/RTCP sockets etc. How will you handle authentication? Multiple client devices?

我的研究,到目前为止,是我必须写在记录到本地套接字,而不是到一个文件中的视频,因为如果写入文件的3GP文件无法访问,直到完成(当视频被停止,标题信息已被写入到约长度及其他)的视频

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发送帧是正确的做法。由于采集设备捕捉每一帧,你需要连接code / COM preSS它,它通过套接字发送。 3GP,MP4一样,是用于存​​储文件的一种容器格式。对于实时捕捉,没有必要写入文件。唯一的一次,这是有道理的是如在HTTP实时流或DASH的方法,其中介质写入传输流或mp4文件,提供服务通过HTTP之前。

Sending frames in real-time over RTP/RTCP is the correct approach. As the capture device captures each frame, you need to encode/compress it and send it over the socket. 3gp, like mp4, is a container format used for file storage. For live capture there is no need to write to a file. The only time this makes sense is e.g. in HTTP Live Streaming or DASH approaches, where media is written to a transport stream or mp4 file, before being served over HTTP.

当插座接收到连续的数据,我将需要把它包装成RTP分组,并将其发送到远程服务器。我可能还必须先做好基本的编码(这是不那么重要的还)。

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).

我会不同意,编码的非常的重要,你可能永远不会设法以其他方式发送视频,你就必须处理的问题,如成本(移动网络),只是媒体根据分辨率和帧率的绝对数量。

I would disagree, encoding is very important, you'll likely never manage to send the video otherwise, and you'll have to deal with issues such as cost (over mobile networks) and just the sheer volume of media depending on resolution and framerate.

没有任何人有任何想法,如果这个理论是正确为止。我也想知道,如果有人可以点我到几个code-片段的类似的方法,特别是对于在飞行到服务器发送视频。我还不确定该怎么做。

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 的开源项目作为起点。 它包含了许多必要的步骤,包括如何配置EN codeR,packetise到RTP,RTCP发送,以及一些RTSP服务器功能。 Spydroid设置了一个RTSP服务器,这样的媒体是连接codeD和发送一次RTSP客户端,例如VLC用于设置RTSP会话。由于您的应用程序是由手机用户想要发送媒体到服务器驱动,你可能需要考虑另一种方法,启动发送,即使你发送某种信息发送到服务器,例如建立一个RTSP会话像spydroid

Take a look at the spydroid open source project as a starting point. It contains many of the necessary steps including how to configure the encoder, packetise to RTP, send RTCP, as well as some RTSP server functionality. Spydroid sets up an RTSP server so media is encoded and sent once an RTSP client such as VLC is used to setup an RTSP session. Since your application is driven by the phone user wanting to send media to a server, you may need to consider another approach to start the sending, even if you send some kind of message to the server to for instance setup an RTSP session like in spydroid.