Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What Techniques Are Best To Live Stream iPhone Video Camera Data To a Computer?

I would like to stream video from an iPhone camera to an app running on a Mac. Think sorta like video chat but only one way, from the device to a receiver app (and it's not video chat).

My basic understanding so far:

  1. You can use AVFoundation to get 'live' video camera data without saving to a file but it is uncompressed data and thus I'd have to handle compression on my own.
  2. There's no built in AVCaptureOutput support for sending to a network location, I'd have to work this bit out on my own.

Am I right about the above or am I already off-track?

Apple Tech Q&A 1702 provides some info on saving off individual frames as images - is this the best way to go about this? Just saving off 30fps and then something like ffmpeg to compress 'em?

There's a lot of discussion of live streaming to the iPhone but far less info on people that are sending live video out. I'm hoping for some broad strokes to get me pointed in the right direction.

like image 572
Hunter Avatar asked Oct 19 '10 00:10

Hunter


People also ask

Can I live stream from my iPhone to my computer?

Connect your phone and PC to the same WiFi network. Tap your PC's name on the list on your phone and then access Control Center and choose Screen Mirroring. Tap the name of your PC. Then you can play the video on your phone and it will be displayed on PC now.

What does a camera need to live stream?

Today, a camera should be able to output a minimum of 1280×720 (i.e., 720p) resolution. We suggest going for at least 1920×1080 (i.e., 1080p), which most cameras today do offer.


1 Answers

You can use AVCaptureVideoDataOutput and a sampleBufferDelegate to capture raw compressed frames, then you just need to stream them over the network. AVFoundation provides an API to encode frames to local video files, but doesn't provide any for streaming to the network. Your best bet is to find a library that streams raw frames over the network. I'd start with ffmpeg; I believe libavformat supports RTSP, look at the ffserver code.

Note that you should configure AVCaptureVideoDataOutput to give you compressed frames, so you avoid having to compress raw video frames without the benefit of hardware encoding.

like image 123
Chris Miles Avatar answered Sep 22 '22 09:09

Chris Miles