Mercurial > hg > nginx-site
annotate xml/en/docs/http/ngx_http_mp4_module.xml @ 583:90a5a62031ad
Added a forgotten link to ngx_http_index_module.
author | Ruslan Ermilov <ru@nginx.com> |
---|---|
date | Wed, 11 Jul 2012 05:21:53 +0000 |
parents | be54c443235a |
children | 764fbac1b8b4 |
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" |
11 lang="en"> | |
12 | |
110
40eec261c2a6
Added proper support for anonymous sections, notably for the summary.
Ruslan Ermilov <ru@nginx.com>
parents:
102
diff
changeset
|
13 <section id="summary"> |
22 | 14 |
15 <para> | |
271 | 16 The module <literal>ngx_http_mp4_module</literal> provides pseudo-streaming |
22 | 17 server-side support for H.264/AAC files typically having filename extensions |
148
682163f2b298
Unified article/path and module/pathname into a single "path".
Ruslan Ermilov <ru@nginx.com>
parents:
110
diff
changeset
|
18 <path>.mp4</path>, <path>.m4v</path>, and <path>.m4a</path>. |
22 | 19 </para> |
20 | |
21 <para> | |
88 | 22 Pseudo-streaming works in alliance with conforming Flash players. |
22 | 23 A player sends an HTTP request to the server with a start time |
24 argument in the request URI’s query string (named simply | |
271 | 25 <literal>start</literal> |
22 | 26 and specified in seconds), and the server responds with a stream |
27 so that its start position corresponds to the requested time, | |
28 for example: | |
29 <example> | |
30 http://example.com/elephants_dream.mp4?start=238.88 | |
31 </example> | |
32 This allows for a random seeking at any time, or starting playback | |
33 in the middle of a timeline. | |
34 </para> | |
35 | |
36 <para> | |
37 To support seeking, H.264-based formats store the metadata | |
38 in the so-called “moov atom.” | |
39 It is a part of the file that holds the index information for the | |
40 whole file. | |
41 </para> | |
42 | |
43 <para> | |
44 To start playback, a player first needs to read metadata. | |
45 This is done by sending a special request with the | |
271 | 46 <literal>start=0</literal> |
22 | 47 argument. Many encoding software will insert the metadata at |
48 the end of the file. This is bad for pseudo-streaming: | |
49 the metadata needs to be located at the beginning of the file, | |
50 or else the entire file will have to be downloaded before it | |
51 starts playing. If a file is well-formed (with metadata at the | |
52 beginning of a file), nginx just sends back the contents of a file. | |
53 Otherwise, it has to read the file and prepare a new stream so that | |
54 metadata comes before media data. | |
55 This involves some CPU, memory, and disk I/O overhead, | |
56 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
|
57 <link |
666e85596e3c
Added support for <link url="..."> which should eventually replace
Ruslan Ermilov <ru@nginx.com>
parents:
33
diff
changeset
|
58 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
|
59 prepare an original file for pseudo-streaming</link>, |
22 | 60 rather than having nginx do this on every such request. |
61 </para> | |
62 | |
63 <para> | |
64 For a matching request with a non-zero | |
271 | 65 <literal>start</literal> |
22 | 66 argument, nginx will read metadata from the file, prepare the |
67 stream starting from the requested offset, and send it to a client. | |
68 This has the same overhead as described above. | |
69 </para> | |
70 | |
71 <para> | |
72 If a matching request does not include the | |
271 | 73 <literal>start</literal> |
22 | 74 argument, there is no overhead, and the file is just sent as a static resource. |
75 Some players also support byte-range requests, and thus do not require | |
76 this module at all. | |
77 </para> | |
78 | |
79 <para> | |
80 This module is not built by default, it should be enabled with the | |
271 | 81 <literal>--with-http_mp4_module</literal> |
22 | 82 configuration parameter. |
83 <note> | |
84 If you were using the third-party mp4 module, be sure to disable it. | |
85 </note> | |
86 </para> | |
87 | |
88 <para> | |
89 A similar pseudo-streaming support for FLV files is provided by the module | |
52
666e85596e3c
Added support for <link url="..."> which should eventually replace
Ruslan Ermilov <ru@nginx.com>
parents:
33
diff
changeset
|
90 <link doc="ngx_http_flv_module.xml">ngx_http_flv_module</link>. |
22 | 91 </para> |
92 | |
93 </section> | |
94 | |
95 | |
53
60796d056dde
Renamed section name "Usage example" to "Example Configuration"
Ruslan Ermilov <ru@nginx.com>
parents:
52
diff
changeset
|
96 <section id="example" name="Example Configuration"> |
22 | 97 |
98 <para> | |
99 <example> | |
100 location /video/ { | |
101 mp4; | |
102 mp4_buffer_size 1m; | |
103 mp4_max_buffer_size 5m; | |
104 } | |
105 </example> | |
106 </para> | |
107 | |
108 </section> | |
109 | |
110 | |
33
ae5aca1efe2c
Using new <module> and <section> format in ngx_http_mp4_module.xml.
Igor Sysoev <igor@sysoev.ru>
parents:
22
diff
changeset
|
111 <section id="directives" name="Directives"> |
22 | 112 |
113 <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
|
114 <syntax/> |
22 | 115 <default/> |
116 <context>location</context> | |
117 | |
118 <para> | |
119 Turns on module processing in a surrounding location. | |
120 </para> | |
121 | |
122 </directive> | |
123 | |
124 | |
125 <directive name="mp4_buffer_size"> | |
271 | 126 <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
|
127 <default>512K</default> |
22 | 128 <context>http</context> |
129 <context>server</context> | |
130 <context>location</context> | |
131 | |
132 <para> | |
133 Sets the initial size of a memory buffer used to process MP4 files. | |
134 </para> | |
135 | |
136 </directive> | |
137 | |
138 | |
139 <directive name="mp4_max_buffer_size"> | |
271 | 140 <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
|
141 <default>10M</default> |
22 | 142 <context>http</context> |
143 <context>server</context> | |
144 <context>location</context> | |
145 | |
146 <para> | |
147 During metadata processing, a larger buffer may become necessary. | |
271 | 148 Its size cannot exceed the specified <value>size</value>, |
52
666e85596e3c
Added support for <link url="..."> which should eventually replace
Ruslan Ermilov <ru@nginx.com>
parents:
33
diff
changeset
|
149 or else nginx will return the server error |
666e85596e3c
Added support for <link url="..."> which should eventually replace
Ruslan Ermilov <ru@nginx.com>
parents:
33
diff
changeset
|
150 <http-status code="500" text="Internal Server Error"/>, |
22 | 151 and log the following: |
152 <example> | |
153 "/some/movie/file.mp4" mp4 moov atom is too large: | |
154 12583268, you may want to increase mp4_max_buffer_size | |
155 </example> | |
156 </para> | |
157 | |
158 </directive> | |
159 | |
160 </section> | |
161 | |
162 </module> |