Mercurial > hg > nginx-site
annotate xml/en/docs/http/ngx_http_mp4_module.xml @ 1105:eb3713019359
The module is no longer restricted to acv1/mp4a.
author | Yaroslav Zhuravlev <yar@nginx.com> |
---|---|
date | Tue, 04 Mar 2014 13:02:21 +0000 |
parents | 028f6a4d8046 |
children | 5a7f86254a34 |
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" |
1105
eb3713019359
The module is no longer restricted to acv1/mp4a.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
1104
diff
changeset
|
12 rev="5"> |
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 |
1105
eb3713019359
The module is no longer restricted to acv1/mp4a.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
1104
diff
changeset
|
18 server-side support for MP4 files. |
966 | 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> | |
1104
028f6a4d8046
Corrected punctuation, grammar, style, rephrased some sentences.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
1103
diff
changeset
|
24 Pseudo-streaming works in alliance with a compatible Flash player. |
028f6a4d8046
Corrected punctuation, grammar, style, rephrased some sentences.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
1103
diff
changeset
|
25 The player sends an HTTP request to the server with the 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> | |
1104
028f6a4d8046
Corrected punctuation, grammar, style, rephrased some sentences.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
1103
diff
changeset
|
39 To support seeking, H.264-based formats store metadata |
028f6a4d8046
Corrected punctuation, grammar, style, rephrased some sentences.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
1103
diff
changeset
|
40 in a so-called “moov atom”. |
22 | 41 It is a part of the file that holds the index information for the |
42 whole file. | |
43 </para> | |
44 | |
45 <para> | |
1104
028f6a4d8046
Corrected punctuation, grammar, style, rephrased some sentences.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
1103
diff
changeset
|
46 To start playback, the player first needs to read metadata. |
22 | 47 This is done by sending a special request with the |
1096
f34be6b26447
Corrected text formatting for ngx_http_mp4_module.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
1088
diff
changeset
|
48 <literal>start=0</literal> argument. |
1104
028f6a4d8046
Corrected punctuation, grammar, style, rephrased some sentences.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
1103
diff
changeset
|
49 A lot of encoding software insert the metadata at |
1096
f34be6b26447
Corrected text formatting for ngx_http_mp4_module.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
1088
diff
changeset
|
50 the end of the file. |
1104
028f6a4d8046
Corrected punctuation, grammar, style, rephrased some sentences.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
1103
diff
changeset
|
51 This is suboptimal for pseudo-streaming, because the player |
028f6a4d8046
Corrected punctuation, grammar, style, rephrased some sentences.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
1103
diff
changeset
|
52 has to download the entire file before starting playback. |
028f6a4d8046
Corrected punctuation, grammar, style, rephrased some sentences.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
1103
diff
changeset
|
53 If the metadata are located at the beginning of the file, |
028f6a4d8046
Corrected punctuation, grammar, style, rephrased some sentences.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
1103
diff
changeset
|
54 it is enough for nginx to simply start sending back the file contents. |
028f6a4d8046
Corrected punctuation, grammar, style, rephrased some sentences.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
1103
diff
changeset
|
55 If the metadata are located at the end of the file, |
028f6a4d8046
Corrected punctuation, grammar, style, rephrased some sentences.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
1103
diff
changeset
|
56 nginx must read the entire file and prepare a new stream so that |
028f6a4d8046
Corrected punctuation, grammar, style, rephrased some sentences.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
1103
diff
changeset
|
57 the metadata come before the media data. |
22 | 58 This involves some CPU, memory, and disk I/O overhead, |
59 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
|
60 <link |
666e85596e3c
Added support for <link url="..."> which should eventually replace
Ruslan Ermilov <ru@nginx.com>
parents:
33
diff
changeset
|
61 url="http://flowplayer.org/plugins/streaming/pseudostreaming.html#prepare"> |
1104
028f6a4d8046
Corrected punctuation, grammar, style, rephrased some sentences.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
1103
diff
changeset
|
62 prepare an original file for pseudo-streaming</link> in advance, |
22 | 63 rather than having nginx do this on every such request. |
64 </para> | |
65 | |
66 <para> | |
67 For a matching request with a non-zero | |
271 | 68 <literal>start</literal> |
966 | 69 argument, nginx will read the metadata from the file, prepare the |
1104
028f6a4d8046
Corrected punctuation, grammar, style, rephrased some sentences.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
1103
diff
changeset
|
70 stream starting from the requested offset, and send it to the client. |
22 | 71 This has the same overhead as described above. |
72 </para> | |
73 | |
74 <para> | |
75 If a matching request does not include the | |
271 | 76 <literal>start</literal> |
1104
028f6a4d8046
Corrected punctuation, grammar, style, rephrased some sentences.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
1103
diff
changeset
|
77 argument, there is no overhead, and the file is sent simply as a static |
028f6a4d8046
Corrected punctuation, grammar, style, rephrased some sentences.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
1103
diff
changeset
|
78 resource. |
22 | 79 Some players also support byte-range requests, and thus do not require |
1104
028f6a4d8046
Corrected punctuation, grammar, style, rephrased some sentences.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
1103
diff
changeset
|
80 this module. |
22 | 81 </para> |
82 | |
83 <para> | |
84 This module is not built by default, it should be enabled with the | |
271 | 85 <literal>--with-http_mp4_module</literal> |
22 | 86 configuration parameter. |
87 <note> | |
966 | 88 If a third-party mp4 module was previously used, it should be disabled. |
22 | 89 </note> |
90 </para> | |
91 | |
92 <para> | |
966 | 93 A similar pseudo-streaming support for FLV files is provided by the |
94 <link doc="ngx_http_flv_module.xml">ngx_http_flv_module</link> module. | |
22 | 95 </para> |
96 | |
97 </section> | |
98 | |
99 | |
53
60796d056dde
Renamed section name "Usage example" to "Example Configuration"
Ruslan Ermilov <ru@nginx.com>
parents:
52
diff
changeset
|
100 <section id="example" name="Example Configuration"> |
22 | 101 |
102 <para> | |
103 <example> | |
104 location /video/ { | |
105 mp4; | |
953
aded7086e84f
Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
659
diff
changeset
|
106 mp4_buffer_size 1m; |
aded7086e84f
Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
659
diff
changeset
|
107 mp4_max_buffer_size 5m; |
aded7086e84f
Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
659
diff
changeset
|
108 mp4_limit_rate on; |
aded7086e84f
Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
659
diff
changeset
|
109 mp4_limit_rate_after 30s; |
22 | 110 } |
111 </example> | |
112 </para> | |
113 | |
114 </section> | |
115 | |
116 | |
33
ae5aca1efe2c
Using new <module> and <section> format in ngx_http_mp4_module.xml.
Igor Sysoev <igor@sysoev.ru>
parents:
22
diff
changeset
|
117 <section id="directives" name="Directives"> |
22 | 118 |
119 <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
|
120 <syntax/> |
22 | 121 <default/> |
122 <context>location</context> | |
123 | |
124 <para> | |
125 Turns on module processing in a surrounding location. | |
126 </para> | |
127 | |
128 </directive> | |
129 | |
130 | |
131 <directive name="mp4_buffer_size"> | |
271 | 132 <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
|
133 <default>512K</default> |
22 | 134 <context>http</context> |
135 <context>server</context> | |
136 <context>location</context> | |
137 | |
138 <para> | |
966 | 139 Sets the initial size of a memory buffer used for processing MP4 files. |
22 | 140 </para> |
141 | |
142 </directive> | |
143 | |
144 | |
145 <directive name="mp4_max_buffer_size"> | |
271 | 146 <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
|
147 <default>10M</default> |
22 | 148 <context>http</context> |
149 <context>server</context> | |
150 <context>location</context> | |
151 | |
152 <para> | |
153 During metadata processing, a larger buffer may become necessary. | |
271 | 154 Its size cannot exceed the specified <value>size</value>, |
966 | 155 or else nginx will return the |
156 <http-status code="500" text="Internal Server Error"/> server error, | |
157 and log the following message: | |
22 | 158 <example> |
159 "/some/movie/file.mp4" mp4 moov atom is too large: | |
160 12583268, you may want to increase mp4_max_buffer_size | |
161 </example> | |
162 </para> | |
163 | |
164 </directive> | |
165 | |
953
aded7086e84f
Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
659
diff
changeset
|
166 |
aded7086e84f
Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
659
diff
changeset
|
167 <directive name="mp4_limit_rate"> |
aded7086e84f
Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
659
diff
changeset
|
168 <syntax> |
aded7086e84f
Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
659
diff
changeset
|
169 <literal>on</literal> | |
aded7086e84f
Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
659
diff
changeset
|
170 <literal>off</literal> | |
aded7086e84f
Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
659
diff
changeset
|
171 <value>factor</value></syntax> |
aded7086e84f
Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
659
diff
changeset
|
172 <default>off</default> |
aded7086e84f
Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
659
diff
changeset
|
173 <context>http</context> |
aded7086e84f
Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
659
diff
changeset
|
174 <context>server</context> |
aded7086e84f
Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
659
diff
changeset
|
175 <context>location</context> |
aded7086e84f
Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
659
diff
changeset
|
176 |
aded7086e84f
Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
659
diff
changeset
|
177 <para> |
1103
1fcf8c840dbe
Corrected EN text of mp4_limit_rate, mp4_limit_rate_after, translated into RU.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
1096
diff
changeset
|
178 Limits the rate of response transmission to a client. |
1fcf8c840dbe
Corrected EN text of mp4_limit_rate, mp4_limit_rate_after, translated into RU.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
1096
diff
changeset
|
179 The rate is limited based on the average bitrate of the |
953
aded7086e84f
Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
659
diff
changeset
|
180 MP4 file served. |
956
488a3f738db0
Text revision of commercial modules.
Egor Nikitin <yegor.nikitin@gmail.com>
parents:
953
diff
changeset
|
181 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
|
182 <value>factor</value>. |
956
488a3f738db0
Text revision of commercial modules.
Egor Nikitin <yegor.nikitin@gmail.com>
parents:
953
diff
changeset
|
183 The special value “<literal>on</literal>” corresponds to the factor of 1.1. |
1103
1fcf8c840dbe
Corrected EN text of mp4_limit_rate, mp4_limit_rate_after, translated into RU.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
1096
diff
changeset
|
184 The special value “<literal>off</literal>” disables rate limiting. |
1fcf8c840dbe
Corrected EN text of mp4_limit_rate, mp4_limit_rate_after, translated into RU.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
1096
diff
changeset
|
185 The limit is set per a request, and so if a client simultaneously opens |
1fcf8c840dbe
Corrected EN text of mp4_limit_rate, mp4_limit_rate_after, translated into RU.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
1096
diff
changeset
|
186 two connections, the overall rate will be twice as much |
1fcf8c840dbe
Corrected EN text of mp4_limit_rate, mp4_limit_rate_after, translated into RU.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
1096
diff
changeset
|
187 as the specified limit. |
953
aded7086e84f
Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
659
diff
changeset
|
188 </para> |
aded7086e84f
Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
659
diff
changeset
|
189 |
aded7086e84f
Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
659
diff
changeset
|
190 <para> |
aded7086e84f
Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
659
diff
changeset
|
191 <note> |
1088
379cb572a7ec
Paraphrased sentences that mention "commercial subscription".
Ruslan Ermilov <ru@nginx.com>
parents:
966
diff
changeset
|
192 This directive is available as part of our <commercial_version/>. |
953
aded7086e84f
Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
659
diff
changeset
|
193 </note> |
aded7086e84f
Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
659
diff
changeset
|
194 </para> |
aded7086e84f
Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
659
diff
changeset
|
195 |
aded7086e84f
Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
659
diff
changeset
|
196 </directive> |
aded7086e84f
Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
659
diff
changeset
|
197 |
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 <directive name="mp4_limit_rate_after"> |
aded7086e84f
Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
659
diff
changeset
|
200 <syntax><value>time</value></syntax> |
1103
1fcf8c840dbe
Corrected EN text of mp4_limit_rate, mp4_limit_rate_after, translated into RU.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
1096
diff
changeset
|
201 <default>60s</default> |
953
aded7086e84f
Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
659
diff
changeset
|
202 <context>http</context> |
aded7086e84f
Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
659
diff
changeset
|
203 <context>server</context> |
aded7086e84f
Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
659
diff
changeset
|
204 <context>location</context> |
aded7086e84f
Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
659
diff
changeset
|
205 |
aded7086e84f
Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
659
diff
changeset
|
206 <para> |
1103
1fcf8c840dbe
Corrected EN text of mp4_limit_rate, mp4_limit_rate_after, translated into RU.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
1096
diff
changeset
|
207 Sets the initial amount of media data (measured in playback time) |
1fcf8c840dbe
Corrected EN text of mp4_limit_rate, mp4_limit_rate_after, translated into RU.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
1096
diff
changeset
|
208 after which the further transmission of the response to a client |
1fcf8c840dbe
Corrected EN text of mp4_limit_rate, mp4_limit_rate_after, translated into RU.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
1096
diff
changeset
|
209 will be rate limited. |
953
aded7086e84f
Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
659
diff
changeset
|
210 </para> |
aded7086e84f
Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
659
diff
changeset
|
211 |
aded7086e84f
Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
659
diff
changeset
|
212 <para> |
aded7086e84f
Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
659
diff
changeset
|
213 <note> |
1088
379cb572a7ec
Paraphrased sentences that mention "commercial subscription".
Ruslan Ermilov <ru@nginx.com>
parents:
966
diff
changeset
|
214 This directive is available as part of our <commercial_version/>. |
953
aded7086e84f
Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
659
diff
changeset
|
215 </note> |
aded7086e84f
Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
659
diff
changeset
|
216 </para> |
aded7086e84f
Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
659
diff
changeset
|
217 |
aded7086e84f
Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
659
diff
changeset
|
218 </directive> |
aded7086e84f
Commercial version documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
659
diff
changeset
|
219 |
22 | 220 </section> |
221 | |
222 </module> |