Streaming live camera video from iOS (iPhone/iPad) to remote PC / server

Medi The Jedi picture Medi The Jedi · Mar 8, 2014 · Viewed 33.7k times · Source

I've been searching for a while on stackoverflow and around the web for a solution to my video-streaming problem. I need to stream live video being captured from the camera (no high-quality required) from an iOS device to a remote PC in one way, i.e., the iOS device will be sending a video stream to the server/PC but not the opposite.

What appears after some googling and documentation browsing is that there are two main major standards/protocols that can be used:

  • Apple's HTTP Live Streaming (HLS)
  • Adobe's RTMP

Again, my requirement is that the iPhone/iPad will be streaming the video. From what appears on Apple's website, I understand that HLS is to be used from an encoding perspective server-side, and a decoding perspective iOS side. As of RTMP, most libraries that allow iOS streaming have commercial licenses and closed code or require you to go through their P2P infrastructure (for instance angl.tv or tokbox.com/opentok/quick-start). As of HLS, no encoding libraries seem to exist iOS side.

So my questions are:

  • Do you know of any SDK/Library preferably open and free that I could integrate to stream captured video from within my app?
  • If no, do you think developing a custom library would be a risky jungle-crossing endeavour? My guess is to go through AVFoundation and capture camera frames, compress them frame by frame and send them over HTTP. Does that sound crazy performance and bandwidth wise? Note that in that case I would need an HLS or RTMP encoder either ways.

I thank you very much in advance dear friends.

Mehdi.

Answer

jgh picture jgh · Mar 10, 2014

I have developed such a library, and you can find it at github.com/jgh-/VideoCore

I am updating this answer because I have created a simplified iOS API that will allow you to easily setup a Camera/Mic RTMP session. You can find it at https://github.com/jgh-/VideoCore/blob/master/api/iOS/VCSimpleSession.h.

Additionally, VideoCore is now available in CocoaPods.