293

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?

Jonas
  • 121,568
  • 97
  • 310
  • 388
JCL
  • 2,931
  • 3
  • 16
  • 4
  • 10
    I'd like to see an answer to this as well. Have you come up with anything yet? – Jeremy White Jun 06 '10 at 21:07
  • 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. – JCL Jun 14 '10 at 08:10
  • The Video code isn't in the Sipdroid source online though :( – Donal Rafferty Aug 09 '10 at 13:56
  • 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 http://www.mattakis.com/blog/kisg/20090708/broadcasting-video-with-android-without-writing-to-the-file-system – Azlam Oct 08 '10 at 17:04
  • 1
    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. http://bit.ly/vYpWGy – michael Jan 02 '12 at 19:35
  • 1
    You can look into ffserver a component in ffmpeg. – Vinay Oct 13 '10 at 16:11
  • 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. – stinkoid Jun 17 '12 at 22:22
  • Hi JCL, Can you give me some links which help me to stream video from the server to an android. – Haris Jun 10 '13 at 09:58
  • @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 http://stackoverflow.com/questions/17268283/download-video-on-sdcard-from-url/17268343?noredirect=1#17268343 – Dhasneem Jun 24 '13 at 05:13

9 Answers9

127

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

HF_
  • 689
  • 3
  • 9
  • 22
Zhou Chang
  • 1,339
  • 1
  • 8
  • 4
  • 3
    It gives me Errors.. like, java.lang.UnsatisfiedLinkError: Couldn't load teaonly: findLibrary returned null.. If anyone has solution then please share it. Thanks – anddev Mar 19 '12 at 10:04
  • 1
    @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". – Turnsole Jul 23 '12 at 16:09
  • why not upload the .so file to libs folder – pengwang Aug 17 '12 at 15:27
  • 1
    I'm also getting java.lang.UnsatisfiedLinkError error. Please briefly mention steps to remove that error. –  Nov 06 '12 at 14:00
  • @pengwang Because its platform dependent you may have to compile it yourself – Mustafa Mar 01 '13 at 01:10
  • 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. – aarontang Feb 28 '14 at 07:20
  • 1
    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](https://developer.android.com/tools/sdk/ndk/index.html#GetStarted). – Paul Lammertsma Jun 05 '14 at 07:33
  • 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). – Arijoon Sep 02 '14 at 08:07
  • Flash is all but dead. – ekerner Jul 03 '15 at 17:28
  • just gave you your hundredth UPVOTE. hope it earned you a goldie badge. great answer, tks for the share. – tony gil Dec 12 '15 at 13:16
  • Does the app currently make it avaible to stream the android camera view to the webbrowser? – utdev Jul 14 '17 at 15:27
71

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

Simon
  • 739
  • 5
  • 3
  • 2
    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! – Yotes Aug 29 '12 at 17:07
  • 1
    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? – Rohit Mandiwal Nov 08 '12 at 01:37
  • 1
    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! – MacD Apr 23 '14 at 11:40
  • @MacD Do you use the spydroid-ipcamera code (all the project or only some classes? Can you tell me?) or this library https://github.com/fyhertz/libstreaming for streaming in Google Glass? Thanks a lot!! – Bae May 06 '14 at 07:00
  • Hi could you explain how to implement this project in android studio I cannot make it run – utdev May 19 '17 at 09:12
24

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

ObsidianX
  • 529
  • 5
  • 4
  • 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 – Azlam Oct 08 '10 at 18:33
  • Nope.. I didn't go for the SIPDroid Approach, it was too complex.. I then did something with a MJPEGServer – Azlam Jan 21 '13 at 12:10
20

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.

Community
  • 1
  • 1
dbro
  • 1,718
  • 1
  • 20
  • 34
  • can it stream to any HLS-capable client (not to your server only)? – 4ntoine Dec 10 '14 at 09:03
  • 4
    @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. – learner Sep 12 '15 at 06:14
  • 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 – Lutaaya Huzaifah Idris Mar 23 '17 at 12:23
11

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.
Minion
  • 565
  • 1
  • 7
  • 23
5

I am able to send the live camera video from mobile to my server.using this link see the link

Refer the above link.there is a sample application in that link. Just you need to set your service url in RecordActivity.class.

Example as: ffmpeg_link="rtmp://yourserveripaddress:1935/live/venkat";

we can able to send H263 and H264 type videos using that link.

Venkat
  • 3,447
  • 6
  • 42
  • 61
  • 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? – Akhilesh Sk Sep 30 '14 at 14:10
  • @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. – Venkat Oct 01 '14 at 04:29
  • 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 Mar 23 '17 at 12:19
  • @LutaayaHuzaifahIdris yes its possible. I worked previously on this. – Venkat May 05 '17 at 05:50
  • Hi @Venkat can you help me out with this, not able to find the RecordActivity.class file – sanyam Apr 22 '20 at 12:00
  • hi venkat the above code is very old it is not building iam getting errors while building the code – v teja Mar 01 '21 at 04:35
1

Check Yasea library

Yasea is an Android streaming client. It encodes YUV and PCM data from camera and microphone to H.264/AAC, encapsulates in FLV and transmits over RTMP.

Feature:

  1. Android mini API 16.
  2. H.264/AAC hard encoding.
  3. H.264 soft encoding.
  4. RTMP streaming with state callback handler.
  5. Portrait and landscape dynamic orientation.
  6. Front and back cameras hot switch.
  7. Recording to MP4 while streaming.
Hamed Ghadirian
  • 6,159
  • 7
  • 48
  • 67
1

Mux (my company) has an open source android app that streams RTMP to a server, including setting up the camera and user interactions. It's built to stream to Mux's live streaming API but can easily stream to any RTMP entrypoint.

heff
  • 3,171
  • 1
  • 20
  • 21
-7

Depending by your budget, you can use a Raspberry Pi Camera that can send images to a server. I add here two tutorials where you can find many more details:

This tutorial show you how to use a Raspberry Pi Camera and display images on Android device

This is the second tutorial where you can find a series of tutorial about real-time video streaming between camera and android device

Ezu
  • 160
  • 1
  • 8