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

查看:36
本文介绍了从 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 上捕获帧,发送帧到媒体服务器,有媒体服务器发布实时视频使用主机网络服务器.

  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直播.

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用于直播.这是一个很好的答案,有人用过吗?

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天全站免登陆