Streaming video from Android camera to server

249,901

Solution 1

I have hosted an open-source project to enable Android phone to IP camera:

http://code.google.com/p/ipcamera-for-android

Raw video data is fetched from LocalSocket, and the MDAT MOOV of MP4 was checked first before streaming. The live video is packed in FLV format, and can be played via Flash video player with a build in web server :)

Solution 2

Took me some time, but I finally manage do make an app that does just that. Check out the google code page if you're interested: http://code.google.com/p/spydroid-ipcamera/ I added loads of comments in my code (mainly, look at CameraStreamer.java), so it should be pretty self-explanatory. The hard part was actually to understand the RFC 3984 and implement a proper algorithm for the packetization process. (This algorithm actually turns the mpeg4/h.264 stream produced by the MediaRecorder into a nice rtp stream, according to the rfc)

Bye

Solution 3

I'm looking into this as well, and while I don't have a good solution for you I did manage to dig up SIPDroid's video code:

http://code.google.com/p/sipdroid/source/browse/trunk/src/org/sipdroid/sipua/ui/VideoCamera.java

Solution 4

I've built an open-source SDK called Kickflip to make streaming video from Android a painless experience.

The SDK demonstrates use of Android 4.3's MediaCodec API to direct the device hardware encoder's packets directly to FFmpeg for RTMP (with librtmp) or HLS streaming of H.264 / AAC. It also demonstrates realtime OpenGL Effects (titling, chroma key, fades) and background recording.

Thanks SO, and especially, fadden.

Solution 5

Here is complete article about streaming android camera video to a webpage.

Android Streaming Live Camera Video to Web Page

  1. Used libstreaming on android app
  2. On server side Wowza Media Engine is used to decode the video stream
  3. Finally jWplayer is used to play the video on a webpage.
Share:
249,901

Related videos on Youtube

JCL
Author by

JCL

Updated on December 19, 2020

Comments

  • JCL
    JCL over 3 years

    I've seen plenty of info about how to stream video from the server to an android device, but not much about the other way, ala Qik. Could someone point me in the right direction here, or give me some advice on how to approach this?

    • Krika
      Krika almost 14 years
      I'd like to see an answer to this as well. Have you come up with anything yet?
    • JCL
      JCL almost 14 years
      Nope, gave up on streaming. Just beating the MediaRecorder API into submission was tough enough. You could check out the sipdroid code though, they seem to have gotten it working.
    • Donal Rafferty
      Donal Rafferty over 13 years
      The Video code isn't in the Sipdroid source online though :(
    • Azlam
      Azlam over 13 years
      I am also looking for a solution.. Found out one part Media Recorder API can be used to stream to server, Now what to do in the server.. Here is one of the link mattakis.com/blog/kisg/20090708/…
    • Vinay
      Vinay over 13 years
      You can look into ffserver a component in ffmpeg.
    • michael
      michael over 12 years
      I have a question related to this one that might be of interest to you as well. It's regarding pushing the video stream over 3g once you have video capture and container part done. bit.ly/vYpWGy
    • stinkoid
      stinkoid almost 12 years
      So, this is almost two years later, but this is still coming up in search results, so this could be useful to somebody: you can stream video from a Google Hangout.
    • Haris
      Haris almost 11 years
      Hi JCL, Can you give me some links which help me to stream video from the server to an android.
    • Dhasneem
      Dhasneem almost 11 years
      @JCL I want to stream video/ audio from url to an android device. Please prefer any link to get this. And Have a look into below link stackoverflow.com/questions/17268283/…
  • Azlam
    Azlam over 13 years
    What they have done over there is they stream using RTP packets to a server.Now the question is what is being done on the server? what does the trans-coding and how is it getting streamed
  • anddev
    anddev about 12 years
    It gives me Errors.. like, java.lang.UnsatisfiedLinkError: Couldn't load teaonly: findLibrary returned null.. If anyone has solution then please share it. Thanks
  • Turnsole
    Turnsole almost 12 years
    @mpp: The app has NDK code. You can compile it yourself, or grab the .so files out of the apk that's in that Google Code project under "Downloads".
  • pengwang
    pengwang over 11 years
    why not upload the .so file to libs folder
  • Yotes
    Yotes over 11 years
    Thanks a lot! Currently I cannot make it work right with h264.. and I can't change it to h263 (I have no clue of how to do that). anyway, thanks man!
  • Admin
    Admin over 11 years
    I'm also getting java.lang.UnsatisfiedLinkError error. Please briefly mention steps to remove that error.
  • Rohit Mandiwal
    Rohit Mandiwal over 11 years
    I am using same but when it comes to stream on Android with rtsp, it says Video could not be played. I am using VideoView. Can you please help?
  • Azlam
    Azlam over 11 years
    Nope.. I didn't go for the SIPDroid Approach, it was too complex.. I then did something with a MJPEGServer
  • Mustafa
    Mustafa about 11 years
    @pengwang Because its platform dependent you may have to compile it yourself
  • aarontang
    aarontang about 10 years
    Here's a tip you can avoid the UnstatisfiedLinkError. Unpacking the ipcamera.apk, you'll find the two libs under lib/armeabi, put them into the source code project lib/armeabi. I've verified, it works.
  • MacD
    MacD about 10 years
    Works great (so far!) I'm using it to stream video from Glass (after a bit of work/editing/figuring out), but so far I can only get it to connect from a Windows based browser (Chrome) with the vlc plugin. VLC on Android/iPad or any other rtsp player won't pick up the stream (one of them looked good, but was trying to get a stream based on the device name, which this code returned as 0 and thus unfindable). Still, getting results after a day of coding thanks to you, so kudos!
  • Bae
    Bae almost 10 years
    @MacD Do you use the spydroid-ipcamera code (all the project or only some classes? Can you tell me?) or this library github.com/fyhertz/libstreaming for streaming in Google Glass? Thanks a lot!!
  • Bahadır Yıldırım
    Bahadır Yıldırım almost 10 years
    For those not understanding the UnsatisfiedLinkError: you have to build the C code with the NDK. Simply put, run ndk-build. For more information, read the NDK documentation.
  • Arijoon
    Arijoon over 9 years
    If you are getting the NKD error, Google Android NKD, Download it and add it to your build path. Also in your project properties, (C/C++ build path) make sure it links to the correct nkd-build file (Put in your nkd-build absolute path if your unsure).
  • Akhilesh Sk
    Akhilesh Sk over 9 years
    I have used the code using the above link, but couldn't even able to start recording. getting an exception "No Video to Stream". Do you have any idea regarding this?
  • Venkat
    Venkat over 9 years
    @AkhileshSk by using the above code u can send the live video through rtmp url to your server. it is not for recording purpose. if you want to record the video u need to record it at server side.
  • 4ntoine
    4ntoine over 9 years
    can it stream to any HLS-capable client (not to your server only)?
  • ekerner
    ekerner almost 9 years
    Flash is all but dead.
  • Raj
    Raj over 8 years
    This uses closed-source components. Any open-source alternatives?
  • learner
    learner over 8 years
    @dbro I try to learn about your service, but you require my login information before I can see your pricing. It's as if you guys are collecting email addresses. If that's not your intention, you should make pricing info available: the same way Parse and App Engine and many others have done.
  • tony gil
    tony gil over 8 years
    just gave you your hundredth UPVOTE. hope it earned you a goldie badge. great answer, tks for the share.
  • Chinthaka Devinda
    Chinthaka Devinda over 7 years
    You may use JavaCV for this I used it in my project to make live streaming from android device to wowza media server also you can use github.com/begeekmyfriend/yasea
  • Lutaaya Huzaifah Idris
    Lutaaya Huzaifah Idris about 7 years
    Hey @ Venkat is it possible to send a live video from a Camera to Android phone , do you have some code links , like using Youtube live etc
  • Lutaaya Huzaifah Idris
    Lutaaya Huzaifah Idris about 7 years
    Is it possible for a Video camera to send a video to Kickflip then it goes to android phone? If es which type of Video Camera is suitable for this
  • Venkat
    Venkat almost 7 years
    @LutaayaHuzaifahIdris yes its possible. I worked previously on this.
  • utdev
    utdev almost 7 years
    Hi could you explain how to implement this project in android studio I cannot make it run
  • utdev
    utdev almost 7 years
    Does the app currently make it avaible to stream the android camera view to the webbrowser?
  • AKRAM EL HAMDAOUI
    AKRAM EL HAMDAOUI over 6 years
    is libs streaming free?
  • user2980181
    user2980181 over 5 years
    can we use sound card device as input audio source and not mic in libstreaming.
  • sanyam
    sanyam about 4 years
    Hi @Venkat can you help me out with this, not able to find the RecordActivity.class file
  • Vikas Kandari
    Vikas Kandari almost 4 years
    out of the context
  • v teja
    v teja about 3 years
    hi venkat the above code is very old it is not building iam getting errors while building the code