来自 Android 设备摄像头的视频流
我正在尝试在 Android 上构建一个应用程序,将视频从设备摄像头流式传输到流媒体服务器。
我查看了不同的帖子和解决方案,这是我当前的状态,在(我使用 Sipdroid、jboss-netty 和在wireshark 上分析数据包)的帮助下,
- 我构建了 RTSP 堆栈并成功连接到服务器
2.理论上我能够创建一个rtp数据包并将其发送到 服务器
我的问题是捕获帧并发送 RTP 数据包中的数据。 我有 2 个方向:
1-使用相机和 AuidoRecorder 捕获原始媒体数据并使用 rtp 发送它,问题是该数据是否应该根据 RTSP 的 ANNOUNCE 中的 .sdp 文件描述进行编码???据我了解,来自相机和麦克风的数据将是未编码的原始数据 另一件事是如何正确地在 RTP 数据包中表达这些原始数据。
2-媒体记录器已经对数据进行了编码,我可以按照 .sdp 文件中定义的方式设置编码。我尝试找到一种从输出文件中读取的方法,但这需要我转换 .mp4 文件数据流数据这似乎是一项复杂的任务。
我的问题是我是否使事情变得过于复杂,是否足以以 RTP 数据包发送视频和音频的原始数据,而流媒体服务器将处理其余部分??? 请在这方面提供任何帮助和指导,我将不胜感激。
谢谢
I am trying to build an application on Android that streams a video from device camera to a streaming server.
I have looked at different posts and solutions and here is my current state, with the help of (I used Sipdroid, jboss-netty, and analyzing packets on wireshark)
- I built the RTSP Stack and I successfully connect to the server
2.I am able theoretically able to create an rtp packet and sent it to
the server
My problem is in capturing the frame and sending the data in the RTP packet.
I have 2 directions:
1- Use the camera and AuidoRecorder to capture the raw media data and send it using rtp, the problem is should this data be encoded according to the .sdp file description in the ANNOUNCE of the RTSP ??? as I understand the data from the camera and mic will be raw data that is not encoded
Anorther thing is how can I formulate this raw data in the RTP packet properly.
2- The Media recorder already encodes the data and I am able to set the encoding as defined in the .sdp file .. I tried to find a way to read from the output file but this would require me to transform the .mp4 file data to stream data which seems like a complicated task.
My question is am I over complicating things is it enough to send the raw data of video and audio in RTP packets and the streaming server would handle the rest ????
Please I would appreciate any help and guidance in that matter..
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
首先,您必须按照 .sdp 文件的描述对数据进行编码。您想尝试 MediaRecorder 而不是 AuidoRecord 吗? MediaRecorder 允许您设置将获得的数据的编码。
此外,我建议您通过套接字创建一个FileDescriptor,以便可以通过套接字流而不是静态文件传输数据。
代码可能是这样的:
RTP 中的传输方法正是现在困扰我的问题。
Firstly you must encode your data as it described by the .sdp file. Would you like to try MediaRecorder rather than AuidoRecord? MediaRecorder allows you to set the encoding of the data you'll get.
Besides, I suggest you create a FileDescriptor by a Socket so that the data can be transport via socket stream rather than a static file.
The code may like this:
The method to transport in RTP is just what troubles me now.