使用Android将实时视频流传输到服务器 [英] Transfer real-time video stream to server using Android

查看:1174
本文介绍了使用Android将实时视频流传输到服务器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们必须使用Android Camera捕获实时视频,并将其发送到服务器,然后其他用户才能通过浏览器或其他方式读取它们.

We have to capture the real-time video using Android Camera, and send them to the server, then other users would read them through the browser or something else.

我已经在Google上进行了搜索和搜索,并且有一些有关视频流应用的示例,例如:

I have Googled and searched at SO, and there are some examples about video stream app like:

1个Android-eye: https://github.com/Teaonly/android-eye

1 Android-eye: https://github.com/Teaonly/android-eye

2 Spydroid-ipcamera: https://code.google.com/p/spydroid- ipcamera/

2 Spydroid-ipcamera:https://code.google.com/p/spydroid-ipcamera/

但是,似乎它们具有不同的环境,大多数应用程序将启动HTTP服务器以进行流请求,然后客户端将通过本地网络访问该页面并观看视频.

However it seems that they have different environments, most of the apps will start an HTTP server for stream requests, then the client will visit the page through the local network and see the video.

然后,视频流源和服务器都是这样的设备:

Then the video stream source and the server are both the device like this:

但是我们需要这样的互联网支持:

But we need the internet support like this:

所以我想知道是否还有其他选择.

So I wonder if there are any alternative ideas.

推荐答案

我可以在第二张图中看到您已经正确设计了这三个阶段.

I can see you have designed the three stages correctly, in your second diagram.

因此,您需要确定如何在这些协议中进行选择以及如何进行接口. 没有人能为您提供完整的解决方案,但是在Android Video Streaming上完成了一个企业项目后,我会尽力将您的眼光转向您的目标.

So what you need is to determine how to choose among these protocols and how to interface them. No one can give you a complete solution but having completed an enterprise project on Android Video Streaming I will try to straighten your sight towards your goal.

您的图片中包含三个部分,我将从左至右进行详细说明:

There are three parts in your picture, I'll elaborate from left to right:

根据我的经验,由于本地支持,同时将视频转换为FLV会让您头疼. (在许多情况下,例如,如果您以后想将流传送到Android设备上.)

Based on my experience, I can say Android does well sending Camera streams over RTP, due to native support, while converting your video to FLV gives you headache. (In many cases, e.g. if later you want to deliver the stream on to the Android devices.)

所以我建议在类似 spyDroid 之类的东西上构建.

So I would suggest building up on something like spyDroid.

有些工具,例如 Wowza Server ,可以获取源流 并将其放在其他客户端的服务器输出上.我猜 VLC也可以通过File-> Stream菜单执行此操作,然后将 来自基于spyDroid的应用程序的RTSP视频流地址.但我有 没有亲自尝试过.

There are tools like Wowza Server which can get a source stream and put it on the output of the server for other clients. I guess VLC can do this too, via File-->Stream menu, an then putting the RTSP video stream address from your spyDroid based app. But I have not tried it personally.

实现自己的流媒体服务器也不是一件容易的事.

Also it is not a hard work to implement your own streamer server.

我给你举个例子:

要实现HLS服务器,您只需要三件事:

For Implementation of an HLS server, you just need three things:

  1. 视频文件,分为10秒MPEG2块. (即.ts文件)
  2. 块的m3U8播放列表.
  3. 具有简单Web服务的Web服务器,可通过HTTP将播放列表传递到客户端(PC,Android,iPhone,主要是每个设备).然后,客户端将查找播放列表文件,并根据其时间要求提供适当的块.因为几乎所有播放器都具有内置的HLS支持.

3.客户端

根据我们的评论,我建议您可能想更深入地研究Android Video Streaming.

3. The Client-Side

Based on our comments, I suggest you might want to dig deeper into Android Video Streaming.

要完成如此大的项目,您需要更多的研究.例如,您应该能够区分RTP和RTSP,并了解它们之间的关系.

To complete a project this big, you need much more research. For example you should be able to distinguish RTP from RTSP and understand how they are related to each other.

此处阅读我的答案,以了解最新的视频流,请随时要求更多.

Read my answer here to get a sense of state-of-the-art Video Streaming and please feel free to ask for more.

希望您对未来的旅程有全面了解,

Hope you got the big picture of the journey ahead,

祝你好运

这篇关于使用Android将实时视频流传输到服务器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆