Mercurial > hg > nginx-site
annotate xml/en/docs/http/ngx_http_mp4_module.xml @ 1093:e9d8300a46ef
Fixup previous commit.
author | Maxim Dounin <mdounin@mdounin.ru> |
---|---|
date | Tue, 04 Mar 2014 19:22:07 +0400 |
parents | 379cb572a7ec |
children | f34be6b26447 |
rev | line source |
---|---|
22 | 1 <?xml version="1.0"?> |
2 | |
580
be54c443235a
Added copyright markers to documentation sources.
Ruslan Ermilov <ru@nginx.com>
parents:
271
diff
changeset
|
3 <!-- |
be54c443235a
Added copyright markers to documentation sources.
Ruslan Ermilov <ru@nginx.com>
parents:
271
diff
changeset
|
4 Copyright (C) Nginx, Inc. |
be54c443235a
Added copyright markers to documentation sources.
Ruslan Ermilov <ru@nginx.com>
parents:
271
diff
changeset
|
5 --> |
be54c443235a
Added copyright markers to documentation sources.
Ruslan Ermilov <ru@nginx.com>
parents:
271
diff
changeset
|
6 |
22 | 7 <!DOCTYPE module SYSTEM "../../../../dtd/module.dtd"> |
8 | |
89 | 9 <module name="Module ngx_http_mp4_module" |
22 | 10 link="/en/docs/http/ngx_http_mp4_module.html" |
589 | 11 lang="en" |
953
aded7086e84f
Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
659
diff
changeset
|
12 rev="2"> |
22 | 13 |
110
40eec261c2a6
Added proper support for anonymous sections, notably for the summary.
Ruslan Ermilov <ru@nginx.com>
parents:
102
diff
changeset
|
14 <section id="summary"> |
22 | 15 |
16 <para> | |
966 | 17 The <literal>ngx_http_mp4_module</literal> module provides pseudo-streaming |
18 server-side support for H.264/AAC files. | |
19 Such files typically have the <path>.mp4</path>, <path>.m4v</path>, | |
20 or <path>.m4a</path> filename extensions. | |
22 | 21 </para> |
22 | |
23 <para> | |
966 | 24 The pseudo-streaming works in alliance with a compatible Flash players. |
22 | 25 A player sends an HTTP request to the server with a start time |
966 | 26 specified in the query string argument (named simply |
271 | 27 <literal>start</literal> |
966 | 28 and specified in seconds), and the server responds with the stream |
29 such that its start position corresponds to the requested time, | |
22 | 30 for example: |
31 <example> | |
32 http://example.com/elephants_dream.mp4?start=238.88 | |
33 </example> | |
966 | 34 This allows performing a random seeking at any time, or starting playback |
35 in the middle of the timeline. | |
22 | 36 </para> |
37 | |
38 <para> | |
39 To support seeking, H.264-based formats store the metadata | |
40 in the so-called “moov atom.” | |
41 It is a part of the file that holds the index information for the | |
42 whole file. | |
43 </para> | |
44 | |
45 <para> | |
46 To start playback, a player first needs to read metadata. | |
47 This is done by sending a special request with the | |
271 | 48 <literal>start=0</literal> |
966 | 49 argument. Much of encoding software will insert the metadata at |
22 | 50 the end of the file. This is bad for pseudo-streaming: |
966 | 51 the metadata should be located at the beginning of the file, |
52 or else the entire file will have to be downloaded to | |
53 start playing. If a file is well-formed (with metadata at the | |
54 beginning of a file), nginx just sends back the file contents. | |
22 | 55 Otherwise, it has to read the file and prepare a new stream so that |
966 | 56 the metadata comes before the media data. |
22 | 57 This involves some CPU, memory, and disk I/O overhead, |
58 so it is a good idea to | |
52
666e85596e3c
Added support for <link url="..."> which should eventually replace
Ruslan Ermilov <ru@nginx.com>
parents:
33
diff
changeset
|
59 <link |
666e85596e3c
Added support for <link url="..."> which should eventually replace
Ruslan Ermilov <ru@nginx.com>
parents:
33
diff
changeset
|
60 url="http://flowplayer.org/plugins/streaming/pseudostreaming.html#prepare"> |
666e85596e3c
Added support for <link url="..."> which should eventually replace
Ruslan Ermilov <ru@nginx.com>
parents:
33
diff
changeset
|
61 prepare an original file for pseudo-streaming</link>, |
22 | 62 rather than having nginx do this on every such request. |
63 </para> | |
64 | |
65 <para> | |
66 For a matching request with a non-zero | |
271 | 67 <literal>start</literal> |
966 | 68 argument, nginx will read the metadata from the file, prepare the |
22 | 69 stream starting from the requested offset, and send it to a client. |
70 This has the same overhead as described above. | |
71 </para> | |
72 | |
73 <para> | |
74 If a matching request does not include the | |
271 | 75 <literal>start</literal> |
22 | 76 argument, there is no overhead, and the file is just sent as a static resource. |
77 Some players also support byte-range requests, and thus do not require | |
78 this module at all. | |
79 </para> | |
80 | |
81 <para> | |
82 This module is not built by default, it should be enabled with the | |
271 | 83 <literal>--with-http_mp4_module</literal> |
22 | 84 configuration parameter. |
85 <note> | |
966 | 86 If a third-party mp4 module was previously used, it should be disabled. |
22 | 87 </note> |
88 </para> | |
89 | |
90 <para> | |
966 | 91 A similar pseudo-streaming support for FLV files is provided by the |
92 <link doc="ngx_http_flv_module.xml">ngx_http_flv_module</link> module. | |
22 | 93 </para> |
94 | |
95 </section> | |
96 | |
97 | |
53
60796d056dde
Renamed section name "Usage example" to "Example Configuration"
Ruslan Ermilov <ru@nginx.com>
parents:
52
diff
changeset
|
98 <section id="example" name="Example Configuration"> |
22 | 99 |
100 <para> | |
101 <example> | |
102 location /video/ { | |
103 mp4; | |
953
aded7086e84f
Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
659
diff
changeset
|
104 mp4_buffer_size 1m; |
aded7086e84f
Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
659
diff
changeset
|
105 mp4_max_buffer_size 5m; |
aded7086e84f
Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
659
diff
changeset
|
106 mp4_limit_rate on; |
aded7086e84f
Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
659
diff
changeset
|
107 mp4_limit_rate_after 30s; |
22 | 108 } |
109 </example> | |
110 </para> | |
111 | |
112 </section> | |
113 | |
114 | |
33
ae5aca1efe2c
Using new <module> and <section> format in ngx_http_mp4_module.xml.
Igor Sysoev <igor@sysoev.ru>
parents:
22
diff
changeset
|
115 <section id="directives" name="Directives"> |
22 | 116 |
117 <directive name="mp4"> | |
102
c76a257f3fd4
The directive name is now automatically printed in <default> and <syntax>.
Ruslan Ermilov <ru@nginx.com>
parents:
89
diff
changeset
|
118 <syntax/> |
22 | 119 <default/> |
120 <context>location</context> | |
121 | |
122 <para> | |
123 Turns on module processing in a surrounding location. | |
124 </para> | |
125 | |
126 </directive> | |
127 | |
128 | |
129 <directive name="mp4_buffer_size"> | |
271 | 130 <syntax><value>size</value></syntax> |
102
c76a257f3fd4
The directive name is now automatically printed in <default> and <syntax>.
Ruslan Ermilov <ru@nginx.com>
parents:
89
diff
changeset
|
131 <default>512K</default> |
22 | 132 <context>http</context> |
133 <context>server</context> | |
134 <context>location</context> | |
135 | |
136 <para> | |
966 | 137 Sets the initial size of a memory buffer used for processing MP4 files. |
22 | 138 </para> |
139 | |
140 </directive> | |
141 | |
142 | |
143 <directive name="mp4_max_buffer_size"> | |
271 | 144 <syntax><value>size</value></syntax> |
102
c76a257f3fd4
The directive name is now automatically printed in <default> and <syntax>.
Ruslan Ermilov <ru@nginx.com>
parents:
89
diff
changeset
|
145 <default>10M</default> |
22 | 146 <context>http</context> |
147 <context>server</context> | |
148 <context>location</context> | |
149 | |
150 <para> | |
151 During metadata processing, a larger buffer may become necessary. | |
271 | 152 Its size cannot exceed the specified <value>size</value>, |
966 | 153 or else nginx will return the |
154 <http-status code="500" text="Internal Server Error"/> server error, | |
155 and log the following message: | |
22 | 156 <example> |
157 "/some/movie/file.mp4" mp4 moov atom is too large: | |
158 12583268, you may want to increase mp4_max_buffer_size | |
159 </example> | |
160 </para> | |
161 | |
162 </directive> | |
163 | |
953
aded7086e84f
Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
659
diff
changeset
|
164 |
aded7086e84f
Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
659
diff
changeset
|
165 <directive name="mp4_limit_rate"> |
aded7086e84f
Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
659
diff
changeset
|
166 <syntax> |
aded7086e84f
Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
659
diff
changeset
|
167 <literal>on</literal> | |
aded7086e84f
Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
659
diff
changeset
|
168 <literal>off</literal> | |
aded7086e84f
Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
659
diff
changeset
|
169 <value>factor</value></syntax> |
aded7086e84f
Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
659
diff
changeset
|
170 <default>off</default> |
aded7086e84f
Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
659
diff
changeset
|
171 <context>http</context> |
aded7086e84f
Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
659
diff
changeset
|
172 <context>server</context> |
aded7086e84f
Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
659
diff
changeset
|
173 <context>location</context> |
aded7086e84f
Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
659
diff
changeset
|
174 |
aded7086e84f
Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
659
diff
changeset
|
175 <para> |
956
488a3f738db0
Text revision of commercial modules.
Egor Nikitin <yegor.nikitin@gmail.com>
parents:
953
diff
changeset
|
176 Enables or disables rate limiting based on the average bitrate of the |
953
aded7086e84f
Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
659
diff
changeset
|
177 MP4 file served. |
956
488a3f738db0
Text revision of commercial modules.
Egor Nikitin <yegor.nikitin@gmail.com>
parents:
953
diff
changeset
|
178 To calculate the rate, the bitrate is multiplied by the specified |
953
aded7086e84f
Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
659
diff
changeset
|
179 <value>factor</value>. |
956
488a3f738db0
Text revision of commercial modules.
Egor Nikitin <yegor.nikitin@gmail.com>
parents:
953
diff
changeset
|
180 The special value “<literal>on</literal>” corresponds to the factor of 1.1. |
953
aded7086e84f
Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
659
diff
changeset
|
181 </para> |
aded7086e84f
Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
659
diff
changeset
|
182 |
aded7086e84f
Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
659
diff
changeset
|
183 <para> |
aded7086e84f
Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
659
diff
changeset
|
184 <note> |
1088
379cb572a7ec
Paraphrased sentences that mention "commercial subscription".
Ruslan Ermilov <ru@nginx.com>
parents:
966
diff
changeset
|
185 This directive is available as part of our <commercial_version/>. |
953
aded7086e84f
Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
659
diff
changeset
|
186 </note> |
aded7086e84f
Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
659
diff
changeset
|
187 </para> |
aded7086e84f
Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
659
diff
changeset
|
188 |
aded7086e84f
Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
659
diff
changeset
|
189 </directive> |
aded7086e84f
Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
659
diff
changeset
|
190 |
aded7086e84f
Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
659
diff
changeset
|
191 |
aded7086e84f
Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
659
diff
changeset
|
192 <directive name="mp4_limit_rate_after"> |
aded7086e84f
Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
659
diff
changeset
|
193 <syntax><value>time</value></syntax> |
aded7086e84f
Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
659
diff
changeset
|
194 <default>1m</default> |
aded7086e84f
Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
659
diff
changeset
|
195 <context>http</context> |
aded7086e84f
Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
659
diff
changeset
|
196 <context>server</context> |
aded7086e84f
Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
659
diff
changeset
|
197 <context>location</context> |
aded7086e84f
Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
659
diff
changeset
|
198 |
aded7086e84f
Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
659
diff
changeset
|
199 <para> |
956
488a3f738db0
Text revision of commercial modules.
Egor Nikitin <yegor.nikitin@gmail.com>
parents:
953
diff
changeset
|
200 Limits the rate after sending the specified amount of media data. |
953
aded7086e84f
Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
659
diff
changeset
|
201 </para> |
aded7086e84f
Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
659
diff
changeset
|
202 |
aded7086e84f
Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
659
diff
changeset
|
203 <para> |
aded7086e84f
Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
659
diff
changeset
|
204 <note> |
1088
379cb572a7ec
Paraphrased sentences that mention "commercial subscription".
Ruslan Ermilov <ru@nginx.com>
parents:
966
diff
changeset
|
205 This directive is available as part of our <commercial_version/>. |
953
aded7086e84f
Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
659
diff
changeset
|
206 </note> |
aded7086e84f
Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
659
diff
changeset
|
207 </para> |
aded7086e84f
Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
659
diff
changeset
|
208 |
aded7086e84f
Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
659
diff
changeset
|
209 </directive> |
aded7086e84f
Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
659
diff
changeset
|
210 |
22 | 211 </section> |
212 | |
213 </module> |