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