文档地址:https://developer.apple.com/streaming/
第一章
1、Send live and on-demand audio and video to iPhone, iPad, Mac, Apple TV, and PC with HTTP LIVE Streaming(HLS) technology from Apple.
在苹果里发送直播的和按需的音频和视频给iPhone,iPad,Mac,Apple TV。
2、Using the same protocol that powers the web,HLS lets you deploy content using ordinary web servers and content delivery networks.
使用相同的协议驱使web网络,HLS通过使用通用的web服务器来配置内容以及满足传递网络。
3、HLS is designed for reliability and dynamically adapts to network conditions by optimizing playback for the available speed of wired and wireless connections.
HLS被用来设计可靠性,然后动态地适应网络情形,通过回放,以可行的速度,不论无线还是有线。
4、
(1)Streaming audio or video to iPhone, iPod touch, iPad, or Apple TV
5、HTTP Live Streaming lets you send audio and video over HTTP from an ordinary web server for playback on iOS-based devices—including iPhone, iPad, iPod touch, and Apple TV—and on desktop computers (Mac OS X).
hls让你通过http发送音频和视频,从一个简单服务器到一个基于设备(苹果,pad等)的设备。
6、HTTP Live Streaming supports both live broadcasts and prerecorded content (video on demand).
hls直播和录制好的内容。
9、HTTP Live Streaming supports multiple alternate streams at different bit rates, and the client software can switch streams intelligently as network bandwidth changes
HLS 支持以不同比特率多种交替的流,而客户端的软件能提技巧的抓住牛,AAAA
10、All devices running iOS 3.0 and later include built-in client software for HTTP Live Streaming.
所有跑在3.0以及以后设备都包含内置的含有HLS流的客户端软件。
11、The Safari browser can play HTTP streams within a webpage on iPad and desktop computers, and Safari launches a full-screen media player for HTTP streams on iOS devices with small screens, such as iPhone and iPod touch. Apple TV 2 and later includes an HTTP Live Streaming client.
Safari浏览器能在iPad和桌面电脑上运行HTTP流,safari发行了一个全屏的http的全屏的媒体,但是在设备上是小屏,例如苹果和iPodtouch,苹果电视以及以后包含一个hls客户端
12、iPhone and iPad apps that send large amounts of audio or video data over cellular networks are required to use HTTP Live Streaming.
苹果和iPad 的apps,这些设备通过蜂窝网络发送大量的图片,需要强制性使用HLS流。
13、Mac OS X developers can use the QTKit and AVFoundation frameworks to create desktop applications that play HTTP Live Streams, and iOS developers can use the MediaPlayer and AVFoundation frameworks to create iOS apps.
Mac OSX 开发者能用QTKit和AVFoundation框架创建基于HLS流的桌面应用,iOS开发者能用MediaPlayer和AVFoundation frameworks创建iOS应用。
14、Where possible, use the tag to embed HTTP Live Streaming, and use the or tags only to specify fallback content.
15、Because it uses HTTP, this kind of streaming is automatically supported by nearly all edge servers, media distributors, caching systems, routers, and firewalls.
因为它使用HTTP,这类流会被周围的所有的边缘的服务器,媒体发布者,缓存系统,路径,和防火墙支持。(http附带的嘛)
16、Many existing streaming services require specialized servers to distribute content to end users.
许多存在流的服务需要专业的服务器来分发内容到达用户。
17、These servers require specialized skills to set up and maintain, and in a large-scale deployment this can be costly. HTTP Live Streaming avoids this by using standard HTTP to deliver the media. Additionally, HTTP Live Streaming is designed to work seamlessly in conjunction with media distribution networks for large scale operation
这些服务器需要一些专业的技巧来安装以及维持,并且在大范围开发中,这可能是代价巨大的,HLS通过使用标准的HTTP传递数据避免这样,除此之外,HLS与媒体发布网络无缝连接,为了大范围的操作18、The HTTP live Streaming specification is an IETF internet-Draft.
(IETF因特网,工程任务组)
19、HTTP LIVE Streaming is a way to send audio and video over HTTP from a web Server to client software on the desktop or to iOS-based devices.
20、HTTP Live Streaming sends audio and video as a series of small files, typically of about 10 seconds duration, called media segment files.
HLS 以一些列小的文件来发送视频和音频,一般大概10秒钟那样的时间,这些文件叫做媒体片段文件。
21、An index file, or playlist, gives the clients the URLs of the media segment files
一个index 文件或者playlist文件给予客户端一个媒体片段文件的url.(将一个url分为很多的url)
22、The playlist can be periodically refreshed to accommodate live broadcasts, where media segment files are constantly being produced.
这个playlist文件能被定期的更新用来安排流的直播,在那儿媒体片段文件被定期的产生。
23、You can embed a link to the playlist in a webpage or send it to an app that you’ve written.
你能在一个网页上安置一个对playlist的链接,然后将这个链接发给你写的app.
24、You Can Send Live Streams or Video on Demand, with Optional Encryption
你能按要求选择性加密发送直播流或者视频。
25、For video on demand from prerecorded media, Apple provides a free tool to make media segment files and playlists from MPEG-4 video or QuickTime movies with H.264 video compression, or audio files with AAC or MP3 compression.
对于事先按要求录制的媒体视频,Apple 提供一个免费的工具来产生媒体片段文件和播放列表,mp4视频或者QuickTime movies通过H.264压缩,音频文件来自AAC或者MP3压缩。
26、The playlists and media segment files can be used for video on demand or streaming radio AAAA
播放列表和媒体文件能被用来视频或者流音频。
27、or live streams, Apple provides a free tool to make media segment files and playlists from live MPEG-2 transport streams carrying H.264 video, AAC audio, or MP3 audio. There are a number of hardware and software encoders that can create MPEG-2 transport streams carrying MPEG-4 video and AAC audio in real time.
对于直播流,苹果提供一个免费的工具来产生媒体片段文件和播放列表,这些播放列表来源于一个mp2传输流,传输流覆盖H.264视频,AAC音频,或者MP3音频。
28、There are a number of hardware and software encoders that can create MPEG-2 transport streams carrying MPEG-4 video and AAC audio in real time.
有大量的硬件或者软件解码器能创造mp2传输流,这些流实时覆盖mp4或者aac音频。
29、These tools can be instructed to encrypt your media and generate decryption keys.
这些工具被要求加密你的媒体文件并且产生解密的钥匙。
30、You can use a single key for all your streams, a different key for each stream, or a series of randomly generated keys that change at intervals during a stream.
你能对所有的你的流使用一个简单的钥匙,或者每个流使用一个不同的键,或者一系列随机产生的键,这些键间断的改变,在一个流期间。
31、Keys are further protected by the requirement for an initialization vector, which can also be set to change
periodically.
钥匙能被一个初始化的变量保护,这个初始化的变量能被定期的改变。
32、Prerequisites前提条件
You should have a general understanding of common audio and video file formats and be familiar with how web servers and browsers work.
你应该有一个常用的音视频文件格式的理解,以及熟悉web服务器和浏览器工作的原理。
第二章
HTTP Streaming Architecture 流的结构
1、HTTP Live Streaming allows you to send live or prerecorded audio and video, with support for encryption and authentication, from an ordinary web server to any device running iOS 3.0 or later (including iPad and Apple TV), or any computer with Safari 4.0 or later installed.
HLS 允许你发送直播的或者录制的音视频,在加密和认证条件下,从一个通用的web服务器到任何3.0以上的系统或者任何安装4.0以上的safari。
2、Conceptually ,HTTP Live Streaming consists of three parts: the server component ,the distribution component,and the client software.
从概念上讲,HLS 包含三部分:服务器组件,分发组件,以及客户端软件。
35、The server component is responsible for taking input streams of media and encoding them digitally, encapsulating them in a format suitable for delivery, and preparing the encapsulated media for distribution.
服务器部分是负责获取媒体流然后数字化编译他们,用一个中合适的格式压缩他们以方便传递,以及给压缩的媒体文件做准备。
3、Thedistribution component consists of standard web servers. They are responsible for accepting client requests and delivering prepared media and associated resources to the client. For large-scale distribution, edge networks or other content delivery networks can also be used.
分发组件包含标准的wen服务器(这里有很多分发的服务器),他们是负责接受客户端请求以及传递准备好的媒体文件和关联的资源给客户端。为了更大范围的分发,边际网络或者其他内容传递网络能被使用。(可以这么理解,我们在全国建立各种服务器,当我们请求的时候,我们能通过调用最近的系统来分发给我们)。
4、The client software is responsible for determining the appropriate media to request, downloading those resources, and then reassembling them so that the media can be presented to the user in a continuous stream.
客户端软件负责决定合适的媒体文件来请求、下载这些资源以及重新装置他们以使得这些媒体文件能呈现给用户持续的流。
5、In a typical configuration, a hardware encoder takes audio-video input, encodes it as H.264 video and AAC audio, and outputs it in an MPEG-2 Transport Stream, which is then broken into a series of short media files by a software stream segmenter.
一种典型的配置,一个硬件编码器采集音视频输入,然后用H.264(视频)或者AAC编码(音频),然后输出它以mp2的传输流,这个然后被一个软件流分解器打断为很多短小的媒体文件。
6、MPEG-2 AAA
7、ts文件 AAAA
8、 These files are placed on a web server. The segmenter also creates and maintains an index file containing a list of the media files
这些文件被放在web服务器,分解器也创建和维持一个包含一系列媒体文件索引文件。
9、The URL of the index file is published on the web server
索引文件的url在web服务器中被发布。
10、 Client software reads the index, then requests the listed media files in order and displays them without any pauses or gaps between segments.
客户端软件读取这个索引,然后按顺序请求媒体文件列表,在片段中无间断或者无代沟的展示这些媒体文件。
11、Input can be live or from a prerecorded souce.
输入源能是直播的,也可以来源于已经录制好的。
12、It is typically encoded as MPEG-4 (H.264 video and AAC audio) and packaged in an MPEG-2 Transport Stream by off-the-shelf hardware.
它是一般被MP4编码(视频为H.264 音频 audio)并被现成的硬件打包成MP2传输流
13、The MPEG-2 transport stream is then broken into segments and saved as a series of one or more.ts media files.
然后MP2传输流被打成碎片,并且被保存一系列的ts媒体文件
14、This is typically accomplished using a software tool such as the Apple stream segmenter.
这一般通过使用一个软件工具来完成,例如苹果流分解器。
15、Audio-only streams can be a series of MPEG elementary audio files formatted as AAC with ADTS headers, as MP3, or as AC-3
音频唯一的流能是一系列MPG基本的音频文件,例如拥有ADTS头的AAC,以及MP3,或者AC-3。
ADTS header AAAAAA
15、The segmenter also creates an index file. The index file contains a list of media files. The index file also contains metadata. The index file is an.M3U8 playlist.
这个分解器也能创建一个索引文件,索引文件包含一系列媒体文件,索引文件也包含元数据,索引文件是一个M3U8的playlist.
16、The URL of the index file is accessed by clients, which then request the indexed files in sequence.
索引文件的URL被客户端存取,客户端需要序列里面的索引文件。
17、
Server Components
The server requires a media encoder, which can be off-the-shelf hardware, and a way to break the encoded media into segments and save them as files, which can either be software such as the media stream segmenter provided by Apple or part of an integrated third-party solution.
服务器需要一个媒体编码器,这个是线程的硬件,还需要一种方法来打断编码的媒体近片段以及保存them为文件,这个(指是way)要么是软件,例如被苹果提供的媒体流,或者就是一个完整的第三方解决方案。
18、Media Encoder
The media encoder takes a real-time signal from an audio-video device, encodes the media, and encapsulates it for transport.
媒体编码获取来自音视频设备的一个实时信号(开始录制了),或者直接编码媒体,压缩供传输。
19、Encoding should be set to a format supported by the client device, such as H.264 video and HE-AAC audio. Currently, the supported delivery format is MPEG-2 Transport Streams for audio-video, or MPEG elementary streams for audio-only.
编码应该被设置为一种格式,这中格式能被客户端设备支持的,例如H.264 for 视频,AAC for 音频,目前的,支持的传递格式是MP2格式for音视频传输流,MPEG基本的流只为音频。
20、The encoder delivers the encoded media in an MPEG-2 Transport Stream over the local network to the stream segmenter.
这个编译器将在本地网络上用mp2编译好的媒体传递给流的分解器。
21、MPEG-2 transport streams should not be confused with MPEG-2 video compression.
mp2传输流不应该跟MPWG-2视频压缩混淆。
22、The transport stream is a packaging format that can be used with a number of different compression formats.
传输流是一个打包的格式,这种格式能被用很多种压缩格式。
23、The video encoder should not change stream settings—such as video dimensions or codec type—in the midst of encoding a stream. If a stream settings change is unavoidable, the settings must change at a segment boundary, and the EXT-X-DISCONTINUITY tag must be set on the following segment.
视频的解码器不应该改变流的设置,例如视频的大小或者码的类型,如果一个流的设置改变是不可避免的,设置必须改变一个片段的边界,AAAAA
24、Stream Segmenter
The stream segmenter is a process—typically software—that reads the Transport Stream from the local network and divides it into a series of small media files of equal duration.
流分解器是一个程序,这个程序从本地的网络中读传输流,将它划分Wie一系列的等时间的媒体文件。
25、Even though each segment is in a separate file, video files are made from a continuous stream which can be reconstructed seamlessly.
即使没给片段是在一个分开的文件里,但是视频文件能被组装成一个连续的流,这个流能被无缝地重建。
26、The segmenter also creates an index file containing references to the individual media files
这个分解器也创建一个索引文件,这个文件指向个人的媒体文件。
27、Each time the segmenter completes a new media file, the index file is updated
没当这个分解器完成一个新的媒体文件的时候,这个索引文件就会被更新。
28、The index is used to track the availability and location of the media files.
这个索引被用来跟踪媒体文件的可行性和位置。
29、The segmenter may also encrypt each media segment and create a key file as part of the process
这个分解器可以对媒体片段进行加密还能创建一个键文件作为程序的一部分。
30、Media segments are saved as.ts files (MPEG-2 transport stream files). Index files are saved as.M3U8 playlists.
媒体片段被保存为ts文件,index files被保存为m3u8文件。
31、If you already have a media file encoded using supported codecs, you can use a file segmenter to encapsulate it in an MPEG-2 transport stream and break it into segments of equal length.
如果你已经用支持的编码器来编码一个文件,你能用一个一个文件以MPEG-2的格式来分解器来压缩近一个传输流,然后在打成同等长度的片段。
32、 Media Segment Files
The file segmenter performs the same tasks as the stream segmenter, but it takes files as input instead of streams.
AAAAA
33、The media segment files are normally produced by the stream segmenter, based on input from the encoder, and consist of a series of.ts files containing segments of an MPEG-2 Transport Stream carrying H.264 video and AAC, MP3, or AC-3 audio. For an audio-only broadcast, the segmenter can produce MPEG elementary audio streams containing either AAC audio with ADTS headers, MP3 audio, or AC-3 audio.
AAAAA
33、index files (playlists)
Because the index file format is an extension of the.m3u playlist format, and because the system also supports.mp3 audio media files, the client software may also be compatible with typical MP3 playlists used for streaming Internet radio.
因为这个索引文件是一个m3u 播放列表哥延展,因为这个系统也支持MP3音频文件,AAAAA
Index Files (Playlists)
34、Index files are normally produced by the stream segmenter or file segmenter, and saved as.M3U8 playlists, an extension of the.m3uformat used for MP3 playlists.
Note: Because the index file format is an extension of the.m3u playlist format, and because the system also supports.mp3 audio media files, the client software may also be compatible with typical MP3 playlists used for streaming Internet radio.
35、Here is a very simple example of an index file, in the form of an.M3U8 playlist, that a segmenter might produce if the entire stream were contained in three unencrypted 10-second media files
这里是一个简单的index file 实例,文件以.M3U8播放列表,如果这个完整的流被包含在三个未加密的10秒文件内,这是一个分解器可能产生的下面的文件。(其实就是大视频由三个未加密的小视频组成)
36、For maximum accuracy, you should specify all durations as floating-point values when sending playlists to clients that support version 3 of the protocol or later.
对于最大值的精确性,你应该指定所有的时间间隔。
37、You must specify a protocol version when using floating-point lengths; if the version is omitted, the playlist must conform to version 1 of the protocol.
当你使用一个浮点长度的时候,你必须指定一个协议,如果这个版本省略了,这个播放的序列必须符合协议的版本1。
38、You can use the file segmenter provided by Apple to generate a variety of example playlists, using an MPEG-4 video or AAC or MP3 audio file as a source.
你能用苹果提供的文件分解器产生各种各样的实例播放列表,使用mp4或者aac或者MP3文件作为一个源。
39、The index file may also contain URLs for encryption key files and alternate index files for different bandwidths.
索引文件也包含对加密和密钥文件的URL以及对不同带宽的交叉索引文件。 AAAA