从iPhone到另一台设备(浏览器或iPhone)的实时音频/视频流 [英] Realtime Audio/Video Streaming FROM iPhone to another device (Browser, or iPhone)

查看:201
本文介绍了从iPhone到另一台设备(浏览器或iPhone)的实时音频/视频流的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想将实时视频从iPhone传输到另一台设备(台式机浏览器或另一台iPhone,例如点对点).

I'd like to get real-time video from the iPhone to another device (either desktop browser or another iPhone, e.g. point-to-point).

注意:目前还不是一对多,而是一对一.音频可以是流的一部分,也可以通过iphone上的电话进行.

NOTE: It's not one-to-many, just one-to-one at the moment. Audio can be part of stream or via telephone call on iphone.

我可以想到四种方式...

There are four ways I can think of...

  1. 在iPhone上捕获帧,发送 帧到媒体服务器,有 媒体服务器发布实时视频 使用主机Web服务器.

  1. Capture frames on iPhone, send frames to mediaserver, have mediaserver publish realtime video using host webserver.

在iPhone上捕获帧,转换为 图像,发送到httpserver,有 浏览器中的javascript/AJAX重新加载 来自服务器的图像与 可能.

Capture frames on iPhone, convert to images, send to httpserver, have javascript/AJAX in browser reload images from server as fast as possible.

在iPhone上运行httpServer,在上捕获1秒钟的电影 iPhone,在iPhone上创建M3U8文件,还有其他 用户直接连接到iPhone上的httpServer liveStreaming.

Run httpServer on iPhone, Capture 1 second duration movies on iPhone, create M3U8 files on iPhone, have the other user connect directly to httpServer on iPhone for liveStreaming.

在以下时间拍摄1秒钟的电影 iPhone,在iPhone上创建M3U8文件, 发送到httpServer,有其他 用户连接到httpServer 用于liveStreaming. 这是一个很好的答案,有人可以使用吗?

Capture 1 second duration movies on iPhone, create M3U8 files on iPhone, send to httpServer, have the other user connected to the httpServer for liveStreaming. This is a good answer, has anyone gotten it to work?

是否有更好,更有效的选择? 从iPhone获取数据的最快方法是什么?是ASIHTTPRequest吗?

Is there a better, more efficient option? What's the fastest way to get data off the iPhone? Is it ASIHTTPRequest?

谢谢大家.

推荐答案

发送原始帧或单个图像永远无法满足您的需求(由于数据量和帧数).您也无法通过电话合理地提供任何服务(WWAN网络具有各种防火墙).您需要对视频进行编码,然后将其流传输到服务器,最有可能是通过标准流格式(RTSP,RTMP)进行的. iPhone> = 3GS上有一个H.264编码器芯片.问题在于它不是面向流的.也就是说,它输出最后解析视频所需的元数据.这为您提供了一些选择.

Sending raw frames or individual images will never work well enough for you (because of the amount of data and number of frames). Nor can you reasonably serve anything from the phone (WWAN networks have all sorts of firewalls). You'll need to encode the video, and stream it to a server, most likely over a standard streaming format (RTSP, RTMP). There is an H.264 encoder chip on the iPhone >= 3GS. The problem is that it is not stream oriented. That is, it outputs the metadata required to parse the video last. This leaves you with a few options.

  1. 获取原始数据,并使用FFmpeg在手机上进行编码(将使用大量CPU和电池).
  2. 为H.264/AAC输出编写自己的解析器(非常困难)
  3. 以块的形式进行记录和处理(将增加等于块的长度的延迟,并在开始和停止会话时在每个块之间放下大约1/4秒的视频).

这篇关于从iPhone到另一台设备(浏览器或iPhone)的实时音频/视频流的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆