Streaming video from Android camera to server
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
- Used libstreaming on android app
- On server side Wowza Media Engine is used to decode the video stream
- Finally jWplayer is used to play the video on a webpage.
Related videos on Youtube
JCL
Updated on December 19, 2020Comments
-
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 almost 14 yearsI'd like to see an answer to this as well. Have you come up with anything yet?
-
JCL almost 14 yearsNope, 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 over 13 yearsThe Video code isn't in the Sipdroid source online though :(
-
Azlam over 13 yearsI 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 over 13 yearsYou can look into ffserver a component in ffmpeg.
-
michael over 12 yearsI 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 almost 12 yearsSo, 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 almost 11 yearsHi JCL, Can you give me some links which help me to stream video from the server to an android.
-
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 over 13 yearsWhat 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 about 12 yearsIt gives me Errors.. like, java.lang.UnsatisfiedLinkError: Couldn't load teaonly: findLibrary returned null.. If anyone has solution then please share it. Thanks
-
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 over 11 yearswhy not upload the .so file to libs folder
-
Yotes over 11 yearsThanks 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 over 11 yearsI'm also getting java.lang.UnsatisfiedLinkError error. Please briefly mention steps to remove that error.
-
Rohit Mandiwal over 11 yearsI 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 over 11 yearsNope.. I didn't go for the SIPDroid Approach, it was too complex.. I then did something with a MJPEGServer
-
Mustafa about 11 years@pengwang Because its platform dependent you may have to compile it yourself
-
aarontang about 10 yearsHere'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 about 10 yearsWorks 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 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 almost 10 yearsFor 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 over 9 yearsIf 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 over 9 yearsI 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 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 over 9 yearscan it stream to any HLS-capable client (not to your server only)?
-
ekerner almost 9 yearsFlash is all but dead.
-
Raj over 8 yearsThis uses closed-source components. Any open-source alternatives?
-
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 over 8 yearsjust gave you your hundredth UPVOTE. hope it earned you a goldie badge. great answer, tks for the share.
-
Chinthaka Devinda over 7 yearsYou 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 about 7 yearsHey @ 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 about 7 yearsIs 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 almost 7 years@LutaayaHuzaifahIdris yes its possible. I worked previously on this.
-
utdev almost 7 yearsHi could you explain how to implement this project in android studio I cannot make it run
-
utdev almost 7 yearsDoes the app currently make it avaible to stream the android camera view to the webbrowser?
-
AKRAM EL HAMDAOUI over 6 yearsis libs streaming free?
-
user2980181 over 5 yearscan we use sound card device as input audio source and not mic in libstreaming.
-
sanyam about 4 yearsHi @Venkat can you help me out with this, not able to find the RecordActivity.class file
-
Vikas Kandari almost 4 yearsout of the context
-
v teja about 3 yearshi venkat the above code is very old it is not building iam getting errors while building the code