comparison xml/en/docs/http/ngx_http_mp4_module.xml @ 966:95c3c3bbf1ce

Text review.
author Egor Nikitin <yegor.nikitin@gmail.com>
date Wed, 14 Aug 2013 12:03:41 +0400
parents 488a3f738db0
children 379cb572a7ec
comparison
equal deleted inserted replaced
965:fadccc156188 966:95c3c3bbf1ce
12 rev="2"> 12 rev="2">
13 13
14 <section id="summary"> 14 <section id="summary">
15 15
16 <para> 16 <para>
17 The module <literal>ngx_http_mp4_module</literal> provides pseudo-streaming 17 The <literal>ngx_http_mp4_module</literal> module provides pseudo-streaming
18 server-side support for H.264/AAC files typically having filename extensions 18 server-side support for H.264/AAC files.
19 <path>.mp4</path>, <path>.m4v</path>, and <path>.m4a</path>. 19 Such files typically have the <path>.mp4</path>, <path>.m4v</path>,
20 </para> 20 or <path>.m4a</path> filename extensions.
21 21 </para>
22 <para> 22
23 Pseudo-streaming works in alliance with conforming Flash players. 23 <para>
24 The pseudo-streaming works in alliance with a compatible Flash players.
24 A player sends an HTTP request to the server with a start time 25 A player sends an HTTP request to the server with a start time
25 argument in the request URI’s query string (named simply 26 specified in the query string argument (named simply
26 <literal>start</literal> 27 <literal>start</literal>
27 and specified in seconds), and the server responds with a stream 28 and specified in seconds), and the server responds with the stream
28 so that its start position corresponds to the requested time, 29 such that its start position corresponds to the requested time,
29 for example: 30 for example:
30 <example> 31 <example>
31 http://example.com/elephants_dream.mp4?start=238.88 32 http://example.com/elephants_dream.mp4?start=238.88
32 </example> 33 </example>
33 This allows for a random seeking at any time, or starting playback 34 This allows performing a random seeking at any time, or starting playback
34 in the middle of a timeline. 35 in the middle of the timeline.
35 </para> 36 </para>
36 37
37 <para> 38 <para>
38 To support seeking, H.264-based formats store the metadata 39 To support seeking, H.264-based formats store the metadata
39 in the so-called “moov atom.” 40 in the so-called “moov atom.”
43 44
44 <para> 45 <para>
45 To start playback, a player first needs to read metadata. 46 To start playback, a player first needs to read metadata.
46 This is done by sending a special request with the 47 This is done by sending a special request with the
47 <literal>start=0</literal> 48 <literal>start=0</literal>
48 argument. Many encoding software will insert the metadata at 49 argument. Much of encoding software will insert the metadata at
49 the end of the file. This is bad for pseudo-streaming: 50 the end of the file. This is bad for pseudo-streaming:
50 the metadata needs to be located at the beginning of the file, 51 the metadata should be located at the beginning of the file,
51 or else the entire file will have to be downloaded before it 52 or else the entire file will have to be downloaded to
52 starts playing. If a file is well-formed (with metadata at the 53 start playing. If a file is well-formed (with metadata at the
53 beginning of a file), nginx just sends back the contents of a file. 54 beginning of a file), nginx just sends back the file contents.
54 Otherwise, it has to read the file and prepare a new stream so that 55 Otherwise, it has to read the file and prepare a new stream so that
55 metadata comes before media data. 56 the metadata comes before the media data.
56 This involves some CPU, memory, and disk I/O overhead, 57 This involves some CPU, memory, and disk I/O overhead,
57 so it is a good idea to 58 so it is a good idea to
58 <link 59 <link
59 url="http://flowplayer.org/plugins/streaming/pseudostreaming.html#prepare"> 60 url="http://flowplayer.org/plugins/streaming/pseudostreaming.html#prepare">
60 prepare an original file for pseudo-streaming</link>, 61 prepare an original file for pseudo-streaming</link>,
62 </para> 63 </para>
63 64
64 <para> 65 <para>
65 For a matching request with a non-zero 66 For a matching request with a non-zero
66 <literal>start</literal> 67 <literal>start</literal>
67 argument, nginx will read metadata from the file, prepare the 68 argument, nginx will read the metadata from the file, prepare the
68 stream starting from the requested offset, and send it to a client. 69 stream starting from the requested offset, and send it to a client.
69 This has the same overhead as described above. 70 This has the same overhead as described above.
70 </para> 71 </para>
71 72
72 <para> 73 <para>
80 <para> 81 <para>
81 This module is not built by default, it should be enabled with the 82 This module is not built by default, it should be enabled with the
82 <literal>--with-http_mp4_module</literal> 83 <literal>--with-http_mp4_module</literal>
83 configuration parameter. 84 configuration parameter.
84 <note> 85 <note>
85 If a third-party mp4 module was previously used, it needs to be disabled. 86 If a third-party mp4 module was previously used, it should be disabled.
86 </note> 87 </note>
87 </para> 88 </para>
88 89
89 <para> 90 <para>
90 A similar pseudo-streaming support for FLV files is provided by the module 91 A similar pseudo-streaming support for FLV files is provided by the
91 <link doc="ngx_http_flv_module.xml">ngx_http_flv_module</link>. 92 <link doc="ngx_http_flv_module.xml">ngx_http_flv_module</link> module.
92 </para> 93 </para>
93 94
94 </section> 95 </section>
95 96
96 97
131 <context>http</context> 132 <context>http</context>
132 <context>server</context> 133 <context>server</context>
133 <context>location</context> 134 <context>location</context>
134 135
135 <para> 136 <para>
136 Sets the initial size of a memory buffer used to process MP4 files. 137 Sets the initial size of a memory buffer used for processing MP4 files.
137 </para> 138 </para>
138 139
139 </directive> 140 </directive>
140 141
141 142
147 <context>location</context> 148 <context>location</context>
148 149
149 <para> 150 <para>
150 During metadata processing, a larger buffer may become necessary. 151 During metadata processing, a larger buffer may become necessary.
151 Its size cannot exceed the specified <value>size</value>, 152 Its size cannot exceed the specified <value>size</value>,
152 or else nginx will return the server error 153 or else nginx will return the
153 <http-status code="500" text="Internal Server Error"/>, 154 <http-status code="500" text="Internal Server Error"/> server error,
154 and log the following: 155 and log the following message:
155 <example> 156 <example>
156 "/some/movie/file.mp4" mp4 moov atom is too large: 157 "/some/movie/file.mp4" mp4 moov atom is too large:
157 12583268, you may want to increase mp4_max_buffer_size 158 12583268, you may want to increase mp4_max_buffer_size
158 </example> 159 </example>
159 </para> 160 </para>