32

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.

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

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

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: enter image description here

But we need the internet support like this: enter image description here

So I wonder if there are any alternative ideas.

Behnam
  • 6,510
  • 6
  • 35
  • 65
hguser
  • 35,079
  • 54
  • 159
  • 293
  • 1
    Have you had the chance to study state-of-the-art Video Streaming Protocols? – Behnam Mar 16 '14 at 06:01
  • In fact, I am not very good at video stream handling, but I have read the related topics like rtmp and rtsp, but I am not sure which is better, and it seems that some of them need the special server for serve stream data, I wonder if this can be simplified . – hguser Mar 17 '14 at 00:07
  • Hi hguser this question is more help full for me, and I have use the YouTube videos and I try to send the another user(server) if there is any idea for this if you have any idea kindly guide me. – Manoj Jun 12 '14 at 07:11

3 Answers3

38

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

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.

enter image description here

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

1. Android Streamer Device

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

So I would suggest building up on something like spyDroid.

2. Streaming Server

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.

I'll give you an example:

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

  1. Video files, segmented into 10 second MPEG2 chunks. (i.e. .ts files)
  2. An m3U8 playlist of the chunks.
  3. A Web Server with a simple WebService that deliver the playlist to the Clients (PC, Android, iPhone, mostly every device) over HTTP. The clients will then look up the playlist file and ask for the appropriate chunks on their according timing. Because nearly all players have built-in HLS support.

3. The Client-Side

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

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,

Good Luck and Have Fun

devgun
  • 1,003
  • 13
  • 33
Behnam
  • 6,510
  • 6
  • 35
  • 65
  • Thank you Campiador, I will do more research. :) – hguser Mar 17 '14 at 11:08
  • But one more question, I know spyDroid from google, but it seems that `spyDroid` itself serve the video stream through the wifi, then we can visit the stream through another computer(use the browser). It seems that the video steam is not pushed but pulled, isn't it? – hguser Mar 17 '14 at 11:10
  • IDK, you might want to ask that in a separate question. – Behnam Dec 10 '14 at 12:19
3

Quite a general question, but I will try to give you a direction for research:

First of all you will need answer several questions:

1) What is the nature and purpose of a video stream? Is it security application, where details in stills are vital (then you will have to use something like MJPEG codec) or it will be viewed only in motion?

2) Are stream source, server and clients on the same network, so that RTSP might be used for more exact timing, or WAN will be involved and something more stable like HTTP should be used?

3) What is the number of simultaneous output connection? In other words, is it worth to pay for something like Wowza with transcoding add-on (and maybe nDVR too) or Flussonic, or simple solution like ffserver will suffice?

To cut long story short, for a cheap and dirty solution for couple of viewers, you may use something like IP Webcam -> ffserver -> VLC for Android and avoid writing your own software.

Community
  • 1
  • 1
David Jashi
  • 4,490
  • 1
  • 21
  • 26
-2

You can handle it this way:

Prepare the camera preview in the way described here. The Camera object has a setPreviewCallback method in which you register the preview callback. This callback provides data buffer (byte array) in YUV format that you can stream to your server.

Gaskoin
  • 2,469
  • 13
  • 22