关于ios对rtsp格式的流媒体支持的一些官方说明

ios明确不支持rtsp格式的流媒体,基于rtsp/rtp对通用性和防炎墙以及需要开新端口等额外影响稳定性和通用性的原因。

而对http流的视频支持是最好的。虽然有第三方的方式配合ffmpeg库,实现了rtsp的流内容播放,但效果很一般。

如果架构的条件不是那么苛刻,不如直接选择http流提供给app去播放呈现。

具体官方说明:

Frequently Asked Questions

  1. What kinds of encoders are supported?

    The protocol specification does not limit the encoder selection. However, the current Apple implementation should interoperate with encoders that produce MPEG-2 Transport Streams containing H.264 video and AAC audio (HE-AAC or AAC-LC). Encoders that are capable of broadcasting the output stream over UDP should also be compatible with the current implementation of the Apple provided segmenter software.

  2. What are the specifics of the video and audio formats supported?

    Although the protocol specification does not limit the video and audio formats, the current Apple implementation supports the following formats:

    • Video:

      • H.264 Baseline Level 3.0, Baseline Level 3.1, Main Level 3.1, and High Profile Level 4.1.
    • Audio:
      • HE-AAC or AAC-LC up to 48 kHz, stereo audio
      • MP3 (MPEG-1 Audio Layer 3) 8 kHz to 48 kHz, stereo audio
      • AC-3 (for Apple TV, in pass-through mode only)

      Note: iPad, iPhone 3G, and iPod touch (2nd generation and later) support H.264 Baseline 3.1. If your app runs on older versions of iPhone or iPod touch, however, you should use H.264 Baseline 3.0 for compatibility. If your content is intended solely for iPad, Apple TV, iPhone 4 and later, and Mac OS X computers, you should use Main Level 3.1.

  3. What duration should media files be?

    The main point to consider is that shorter segments result in more frequent refreshes of the index file, which might create unnecessary network overhead for the client. Longer segments will extend the inherent latency of the broadcast and initial startup time. A duration of 10 seconds of media per file seems to strike a reasonable balance for most broadcast content.

  4. How many files should be listed in the index file during a continuous, ongoing session?

    The normal recommendation is 3, but the optimum number may be larger.

    The important point to consider when choosing the optimum number is that the number of files available during a live session constrains the client‘s behavior when doing play/pause and seeking operations. The more files in the list, the longer the client can be paused without losing its place in the broadcast, the further back in the broadcast a new client begins when joining the stream, and the wider the time range within which the client can seek. The trade-off is that a longer index file adds to network overhead—during live broadcasts, the clients are all refreshing the index file regularly, so it does add up, even though the index file is typically small.

  5. What data rates are supported?

    The data rate that a content provider chooses for a stream is most influenced by the target client platform and the expected network topology. The streaming protocol itself places no limitations on the data rates that can be used. The current implementation has been tested using audio-video streams with data rates as low as 64 Kbps and as high as 3 Mbps to iPhone. Audio-only streams at 64 Kbps are recommended as alternates for delivery over slow cellular connections.

    For recommended data rates, see Preparing Media for Delivery to iOS-Based Devices.

    Note: If the data rate exceeds the available bandwidth, there is more latency before startup and the client may have to pause to buffer more data periodically. If a broadcast uses an index file that provides a moving window into the content, the client will eventually fall behind in such cases, causing one or more segments to be dropped. In the case of VOD, no segments are lost, but inadequate bandwidth does cause slower startup and periodic stalling while data buffers.

  6. What is a .ts file?

    .ts file contains an MPEG-2 Transport Stream. This is a file format that encapsulates a series of encoded media samples—typically audio and video. The file format supports a variety of compression formats, including MP3 audio, AAC audio, H.264 video, and so on. Not all compression formats are currently supported in the Apple HTTP Live Streaming implementation, however. (For a list of currently supported formats, see Media Encoder.

    MPEG-2 Transport Streams are containers, and should not be confused with MPEG-2 compression.

  7. What is an .M3U8 file?

    An .M3U8 file is a extensible playlist file format. It is an m3u playlist containing UTF-8 encoded text. The m3u file format is a de facto standard playlist format suitable for carrying lists of media file URLs. This is the format used as the index file for HTTP Live Streaming. For details, see IETF Internet-Draft of the HTTP Live Streaming specification.

  8. How does the client software determine when to switch streams?

    The current implementation of the client observes the effective bandwidth while playing a stream. If a higher-quality stream is available and the bandwidth appears sufficient to support it, the client switches to a higher quality. If a lower-quality stream is available and the current bandwidth appears insufficient to support the current stream, the client switches to a lower quality.

    Note: For seamless transitions between alternate streams, the audio portion of the stream should be identical in all versions.

  9. Where can I find a copy of the media stream segmenter from Apple?

    The media stream segmenter, file stream segmenter, and other tools are frequently updated, so you should download the current version of the HTTP Live Streaming Tools from the Apple Developer website. See Download the Tools for details.

  10. What settings are recommended for a typical HTTP stream, with alternates, for use with the media segmenter from Apple?

    See Preparing Media for Delivery to iOS-Based Devices.

    These settings are the current recommendations. There are also certain requirements. The current mediastreamsegmenter tool works only with MPEG-2 Transport Streams as defined in ISO/IEC 13818. The transport stream must contain H.264 (MPEG-4, part 10) video and AAC or MPEG audio. If AAC audio is used, it must have ADTS headers. H.264 video access units must use Access Unit Delimiter NALs, and must be in unique PES packets.

    The segmenter also has a number of user-configurable settings. You can obtain a list of the command line arguments and their meanings by typingman mediastreamsegmenter from the Terminal application. A target duration (length of the media segments) of 10 seconds is recommended, and is the default if no target duration is specified.

  11. How can I specify what codecs or H.264 profile are required to play back my stream?

    Use the CODECS attribute of the EXT-X-STREAM-INF tag. When this attribute is present, it must include all codecs and profiles required to play back the stream. The following values are currently recognized:


    AAC-LC


    "mp4a.40.2"


    HE-AAC


    "mp4a.40.5"


    MP3


    "mp4a.40.34"


    H.264 Baseline Profile level 3.0


    "avc1.42001e" or "avc1.66.30"

    Note: Use "avc1.66.30" for compatibility with iOS versions 3.0 to 3.1.2.


    H.264 Baseline Profile level 3.1


    "avc1.42001f"


    H.264 Main Profile level 3.0


    "avc1.4d001e" or "avc1.77.30"

    Note: Use "avc1.77.30" for compatibility with iOS versions 3.0 to 3.12.


    H.264 Main Profile level 3.1


    "avc1.4d001f"


    H.264 Main Profile level 4.0


    "avc1.4d0028"


    H.264 High Profile level 3.1


    "avc1.64001f"


    H.264 High Profile level 4.0


    "avc1.640028"


    H.264 High Profile level 4.1


    "avc1.640028"

    The attribute value must be in quotes. If multiple values are specified, one set of quotes is used to contain all values, and the values are separated by commas. An example follows.

    #EXTM3U
    #EXT-X-STREAM-INF:PROGRAM-ID=1, BANDWIDTH=500000, RESOLUTION=720x480
    mid_video_index.M3U8
    #EXT-X-STREAM-INF:PROGRAM-ID=1, BANDWIDTH=800000, RESOLUTION=1280x720
    wifi_video_index.M3U8
    #EXT-X-STREAM-INF:PROGRAM-ID=1, BANDWIDTH=3000000, CODECS="avc1.4d001e,mp4a.40.5", RESOLUTION=1920x1080
    h264main_heaac_index.M3U8
    #EXT-X-STREAM-INF:PROGRAM-ID=1, BANDWIDTH=64000, CODECS="mp4a.40.5"
    aacaudio_index.M3U8
  12. How can I create an audio-only stream from audio/video input?

    Add the -audio-only argument when invoking the stream or files segmenter.

  13. How can I add a still image to an audio-only stream?

    Use the -meta-file argument when invoking the stream or file segmenter with -meta-type=picture to add an image to every segment. For example, this would add an image named poster.jpg to every segment of an audio stream created from the file track01.mp3:

    mediafilesegmenter -f /Dir/outputFile -a --meta-file=poster.jpg --meta-type=picture track01.mp3

    Remember that the image is typically resent every ten seconds, so it’s best to keep the file size small.

  14. How can I specify an audio-only alternate to an audio-video stream?

    Use the CODECS and BANDWIDTH attributes of the EXT-X-STREAM-INF tag together.

    The BANDWIDTH attribute specifies the bandwidth required for each alternate stream. If the available bandwidth is enough for the audio alternate, but not enough for the lowest video alternate, the client switches to the audio stream.

    If the CODECS attribute is included, it must list all codecs required to play the stream. If only an audio codec is specified, the stream is identified as audio-only. Currently, it is not required to specify that a stream is audio-only, so use of the CODECS attribute is optional.

    The following is an example that specifies video streams at 500 Kbps for fast connections, 150 Kbps for slower connections, and an audio-only stream at 64 Kbps for very slow connections. All the streams should use the same 64 Kbps audio to allow transitions between streams without an audible disturbance.

    #EXTM3U
    #EXT-X-STREAM-INF:PROGRAM-ID=1, BANDWIDTH=500000, RESOLUTION=1920x1080
    mid_video_index.M3U8
    #EXT-X-STREAM-INF:PROGRAM-ID=1, BANDWIDTH=150000, RESOLUTION=720x480
    3g_video_index.M3U8
    #EXT-X-STREAM-INF:PROGRAM-ID=1, BANDWIDTH=64000, CODECS="mp4a.40.5"
    aacaudio_index.M3U8
  15. What are the hardware requirements or recommendations for servers?

    See question #1 for encoder hardware recommendations.

    The Apple stream segmenter is capable of running on any Intel-based Mac. We recommend using a Mac with two Ethernet network interfaces, such as a Mac Pro or an XServe. One network interface can be used to obtain the encoded stream from the local network, while the second network interface can provide access to a wider network.

  16. Does the Apple implementation of HTTP Live Streaming support DRM?

    No. However, media can be encrypted, and key access can be limited by requiring authentication when the client retrieves the key from your HTTPS server.

  17. What client platforms are supported?

    iPhone, iPad, and iPod touch (requires iOS version 3.0 or later), Apple TV (version 2 and later), and Mac OS X computers.

  18. Is the protocol specification available?

    Yes. The protocol specification is an IETF Internet-Draft, at http://tools.ietf.org/html/draft-pantos-http-live-streaming.

  19. Does the client cache content?

    The index file can contain an instruction to the client that content should not be cached. Otherwise, the client may cache data for performance optimization when seeking within the media.

  20. Is this a real-time delivery system?

    No. It has inherent latency corresponding to the size and duration of the media files containing stream segments. At least one segment must fully download before it can be viewed by the client, and two may be required to ensure seamless transitions between segments. In addition, the encoder and segmenter must create a file from the input; the duration of this file is the minimum latency before media is available for download. Typical latency with recommended settings is in the neighborhood of 30 seconds.

  21. What is the latency?

    Approximately 30 seconds, with recommended settings. See question #15.

  22. Do I need to use a hardware encoder?

    No. Using the protocol specification, it is possible to implement a software encoder.

  23. What advantages does this approach have over RTP/RTSP?

    HTTP is less likely to be disallowed by routers, NAT, or firewall settings. No ports need to be opened that are commonly closed by default. Content is therefore more likely to get through to the client in more locations and without special settings. HTTP is also supported by more content-distribution networks, which can affect cost in large distribution models. In general, more available hardware and software works unmodified and as intended with HTTP than with RTP/RTSP. Expertise in customizing HTTP content delivery using tools such as PHP is also more widespread.

    Also, HTTP Live Streaming is supported in Safari and the media player framework on iOS. RTSP streaming is not supported.

  24. Why is my stream’s overall bit rate higher than the sum of the audio and video bitrates?

    MPEG-2 transport streams can include substantial overhead. They utilize fixed packet sizes that are padded when the packet contents are smaller than the default packet size. Encoder and multiplexer implementations vary in their efficiency at packing media data into these fixed packet sizes. The amount of padding can vary with frame rate, sample rate, and resolution.

  25. How can I reduce the overhead and bring the bit rate down?

    Using a more efficient encoder can reduce the amount of overhead, as can tuning the encoder settings.

  26. Do all media files have to be part of the same MPEG-2 Transport Stream?

    No. You can mix media files from different transport streams, as long as they are separated by EXT-X-DISCONTINUITY tags. See the protocol specification for more detail. For best results, however, all video media files should have the same height and width dimensions in pixels.

  27. Where can I get help or advice on setting up an HTTP audio/video server?

    You can visit the Apple Developer Forum at http://devforums.apple.com/.

    Also, check out Best Practices for Creating and Deploying HTTP Live Streaming Media for the iPhone and iPad.

时间: 2024-08-27 09:39:16

关于ios对rtsp格式的流媒体支持的一些官方说明的相关文章

IOS --- 日期时间格式 转换

1.如何如何将一个字符串如" 20110826134106"装化为任意的日期时间格式,下面列举两种类型: NSString* string [email protected]"20110826134106"; NSDateFormatter*inputFormatter = [[[NSDateFormatter alloc] init]autorelease]; [inputFormattersetLocale:[[[NSLocale alloc] initWith

ios非UTF-8格式的网页解析

网上有很多关于ios xml解析的方法,关于非UTF-8格式的网页解析也不少,我也试着看了好几个,但都没成功.今天无意中却弄好了,所以想和大家分享下.其实很简单,下面说下怎么得到非UTF-8格式的网页要解析的代码内容,这也是比较关键的一步,剩余的解析过程网上很多,这里就不在赘述了,如果实在有需要得话,再跟我联系. 1.以百度(http://www.baidu.com)为例,其网页格式为gb2312,新建一个项目project,在-(void)viewDidLoad内输入一下内容: 1NSURL

关于IOS下日期格式分隔符 - 、 /的问题

之前我们项目有一个低价日历,服务端下发的时间格式为: "2014-07-21 09:45:12"  然后一直出不了数据,后来发现. IOS下无论chrome.safari还是Uc如果日期格式是分隔符是 - 的时候,后面带时.分.秒这种情况就是有问题. 大家有兴趣的可以试一下: <script> var s = '2014-04-10 09:10:10'; var d = new Date(s).getTime(); alert(d); //NAN var s2 = '201

iOS 11确认将完全停止支持 32 位应用

苹果正在逐渐淘汰 32 位应用,而且会在今年秋天完成.根据知名开发者 Steven Troughton-Smith 透露,苹果会在 iOS 11 发布后,停止支持 32 位应用.这意味着 App Store 中所有的 32 位应用将无法正常运行. 当然,对于开发者和用户来说,苹果这个决定并不是太意外.从 iOS 10.3 开始,当用户打开 32 位应用后,苹果已经开始提醒用户,应用需要升级,否则可能无法在未来 iOS 版本中运行. 2013年9月,苹果发布了 iPhone 5s,这也是首款搭载

iOS 后台持续定位详解(支持ISO9.0以上)

iOS 后台持续定位详解(支持ISO9.0以上) #import <CoreLocation/CoreLocation.h>并实现CLLocationManagerDelegate 代理,.h文件完整代码如下: [objc] view plain copy #import <UIKit/UIKit.h> #import <CoreLocation/CoreLocation.h> @interface ViewController : UIViewController&l

Rtsp to Rtmp流媒体转发

RTMP是一种设计用来进行实时数据通信的网络协议,主要用来在Flash/AIR平台和支持RTMP协议的流媒体/交互服务器之间进行音视频和数据通信.支持该协议的软件包括Adobe Media Server.Ultrant Media Server.red5.nginx. HTTP Live Streaming(HLS)是苹果公司(Apple Inc.)实现的基于HTTP的流媒体传输协议,可实现流媒体的直播和点播,相对于常见的流媒体直播协议,例如RTMP协议.RTSP协议.MMS协议 等,HLS直播

海康RTSP格式

海康RTSP取流URL格式 一.预览取流 设备预览取流的RTSP URL有新老版本,2012年之前的设备(比如V2.0版本的Netra设 备)支持老的取流格式,之后的设备新老取流格式都支持. RTSP.jpg 1.老版本 URL规定: rtsp://username:[email protected]<ipaddress>/<videotype>/ch<number>/<streamtype> 注:VLC可以支持解析URL里的用户名密码,实际发给设备的RTS

iOS 富文本格式字符 以及处理iOS8下textview设置富文本后输入bug

iOS的富文本设置,在iOS8下在textView的代理方法中设置textview的attributedText时,会出现富文本格式未加到text上的情况,可以在初始化时将文本属性赋给textview的typingAttributes.代码如下: NSMutableParagraphStyle *paragraphStyle = [[NSMutableParagraphStyle alloc] init]; paragraphStyle.lineSpacing = 7;// 字体的行间距 UIF

iOS 系统时间格式区别

今天,遇到一个奇怪的问题,以前也没有注意,当然很少这样写,因为公司项目部分是由外包公司开发的,也没有仔细的review代码.由于iOS时间格式为“YYYY-MM-dd”引起时间相差一年,也就是每年的12月29日开始后一周里如果这样使用会引起时间相差一年.我查了一下资料,具体事说YYYY代表 “week of year”,yyyy代表calendar year.(细节问题,相信很多人以前都没注意!) 原文: A common mistake is to use YYYY. yyyy specifi