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