title: Stream live video from camera on android
body: <p>I am attempting to make an app that will stream a video from the camera of an android phone over the internet using the TCP or UDP protocol. I am currently able to transfer a byte array from the android phone to my computer which is running a server that I have written in C#. I have done streaming video before by sending .jpeg's over the network and showing them at 30 fps but this uses up too much bandwidth.</p>
  
  <p>First what would be the best way of capturing the images from the camera?
  I'm looking at...</p>
  
  <pre><code>onPictureTaken(byte[] data, Camera camera)
  </code></pre>
  
  <p>or</p>
  
  <pre><code>onPreviewFrame (byte[] data, Camera camera)
  </code></pre>
  
  <p>I'm just interested in the byte[] data, taking that and encoding / compressing it then sending it over the network.</p>
  
  <p>Second, how should I turn these frames into a compressed video that is a byte array that can be streamed over the network? I don't care too much about video quality, I care more about cutting down on bandwidth.</p>
  
  <p>Here is what I am trying to do, but I don't need high quality video.
  <a href="https://code.google.com/p/spydroid-ipcamera/" rel="noreferrer">https://code.google.com/p/spydroid-ipcamera/</a></p>