15 |
16 | NAME
17 | librtmp − RTMPDump Real-Time Messaging Protocol API
18 |
19 |
20 | LIBRARY
21 | RTMPDump RTMP (librtmp, -lrtmp)
22 |
23 |
24 | SYNOPSIS
25 | #include <librtmp/rtmp.h>
26 |
27 |
28 | DESCRIPTION
29 | The Real-Time Messaging Protocol (RTMP) is used for streaming
30 | multimedia content across a TCP/IP network. This API provides most client
31 | functions and a few server functions needed to support RTMP, RTMP tunneled
32 | in HTTP (RTMPT), encrypted RTMP (RTMPE), RTMP over SSL/TLS (RTMPS) and
33 | tunneled variants of these encrypted types (RTMPTE, RTMPTS). The basic
34 | RTMP specification has been published by Adobe but this API was
35 | reverse-engineered without use of the Adobe specification. As such, it may
36 | deviate from any published specifications but it usually duplicates the
37 | actual behavior of the original Adobe clients.
38 |
39 | The RTMPDump software package includes a basic client utility program
40 | in
41 | rtmpdump(1),
42 | some sample servers, and a library used to provide programmatic access
43 | to the RTMP protocol. This man page gives an overview of the RTMP
44 | library routines. These routines are found in the -lrtmp library. Many
45 | other routines are also available, but they are not documented yet.
46 |
47 | The basic interaction is as follows. A session handle is created using
48 | RTMP_Alloc()
49 | and initialized using
50 | RTMP_Init().
51 | All session parameters are provided using
52 | RTMP_SetupURL().
53 | The network connection is established using
54 | RTMP_Connect(),
55 | and then the RTMP session is established using
56 | RTMP_ConnectStream().
57 | The stream is read using
58 | RTMP_Read().
59 | A client can publish a stream by calling
60 | RTMP_EnableWrite()
61 | before the
62 | RTMP_Connect()
63 | call, and then using
64 | RTMP_Write()
65 | after the session is established.
66 | While a stream is playing it may be paused and unpaused using
67 | RTMP_Pause().
68 | The stream playback position can be moved using
69 | RTMP_Seek().
70 | When
71 | RTMP_Read()
72 | returns 0 bytes, the stream is complete and may be closed using
73 | RTMP_Close().
74 | The session handle is freed using
75 | RTMP_Free().
76 |
77 | All data is transferred using FLV format. The basic session requires
78 | an RTMP URL. Additional options may be specified by appending
79 | space-separated key=value pairs to the URL. The RTMP URL format
80 | is of the form
81 |
82 | rtmp[t][e|s]://hostname[:port][/app[/playpath]]
83 |
84 |
85 | Plain rtmp, as well as tunneled and encrypted sessions are supported.
86 |
87 |
88 | OPTIONS
90 |
91 | Network Parameters
92 | These options define how to connect to the media server.
93 |
94 | -
95 | socks=host:port
96 |
-
97 | Use the specified SOCKS4 proxy.
98 |
99 |
100 |
101 | Connection Parameters
102 | These options define the content of the RTMP Connect request packet.
103 | If correct values are not provided, the media server will reject the
104 | connection attempt.
105 |
106 | -
107 | app=name
108 |
-
109 | Name of application to connect to on the RTMP server. Overrides
110 | the app in the RTMP URL. Sometimes the librtmp URL parser cannot
111 | determine the app name automatically, so it must be given explicitly
112 | using this option.
113 |
114 |
115 | -
116 | tcUrl=url
117 |
-
118 | URL of the target stream. Defaults to rtmp[t][e|s]://host[:port]/app.
119 |
120 |
121 | -
122 | pageUrl=url
123 |
-
124 | URL of the web page in which the media was embedded. By default no
125 | value will be sent.
126 |
127 |
128 | -
129 | swfUrl=url
130 |
-
131 | URL of the SWF player for the media. By default no value will be sent.
132 |
133 |
134 | -
135 | flashVer=version
136 |
-
137 | Version of the Flash plugin used to run the SWF player. The
138 | default is "LNX 10,0,32,18".
139 |
140 |
141 | -
142 | conn=type:data
143 |
-
144 | Append arbitrary AMF data to the Connect message. The type
145 | must be B for Boolean, N for number, S for string, O for object, or Z
146 | for null. For Booleans the data must be either 0 or 1 for FALSE or TRUE,
147 | respectively. Likewise for Objects the data must be 0 or 1 to end or
148 | begin an object, respectively. Data items in subobjects may be named, by
149 | prefixing the type with 'N' and specifying the name before the value, e.g.
150 | NB:myFlag:1. This option may be used multiple times to construct arbitrary
151 | AMF sequences. E.g.
152 |
153 | conn=B:1 conn=S:authMe conn=O:1 conn=NN:code:1.23 conn=NS:flag:ok conn=O:0
154 |
155 |
156 |
157 |
158 | Session Parameters
159 | These options take effect after the Connect request has succeeded.
160 |
161 | -
162 | playpath=path
163 |
-
164 | Overrides the playpath parsed from the RTMP URL. Sometimes the
165 | rtmpdump URL parser cannot determine the correct playpath
166 | automatically, so it must be given explicitly using this option.
167 |
168 |
169 | -
170 | playlist=0|1
171 |
-
172 | If the value is 1 or TRUE, issue a set_playlist command before sending the
173 | play command. The playlist will just contain the current playpath. If the
174 | value is 0 or FALSE, the set_playlist command will not be sent. The
175 | default is FALSE.
176 |
177 |
178 | -
179 | live=0|1
180 |
-
181 | Specify that the media is a live stream. No resuming or seeking in
182 | live streams is possible.
183 |
184 |
185 | -
186 | subscribe=path
187 |
-
188 | Name of live stream to subscribe to. Defaults to
189 | playpath.
190 |
191 |
192 | -
193 | start=num
194 |
-
195 | Start at
196 | num
197 | seconds into the stream. Not valid for live streams.
198 |
199 |
200 | -
201 | stop=num
202 |
-
203 | Stop at
204 | num
205 | seconds into the stream.
206 |
207 |
208 | -
209 | buffer=num
210 |
-
211 | Set buffer time to
212 | num
213 | milliseconds. The default is 30000.
214 |
215 |
216 | -
217 | timeout=num
218 |
-
219 | Timeout the session after
220 | num
221 | seconds without receiving any data from the server. The default is 120.
222 |
223 |
224 |
225 | Security Parameters
226 | These options handle additional authentication requests from the server.
227 |
228 | -
229 | token=key
230 |
-
231 | Key for SecureToken response, used if the server requires SecureToken
232 | authentication.
233 |
234 |
235 | -
236 | swfVfy=0|1
237 |
-
238 | If the value is 1 or TRUE, the SWF player is retrieved from the
239 | specified
240 | swfUrl
241 | for performing SWF Verification. The SWF hash and size (used in the
242 | verification step) are computed automatically. Also the SWF information is
243 | cached in a
244 | .swfinfo
245 | file in the user's home directory, so that it doesn't need to be retrieved
246 | and recalculated every time. The .swfinfo file records
247 | the SWF URL, the time it was fetched, the modification timestamp of the SWF
248 | file, its size, and its hash. By default, the cached info will be used
249 | for 30 days before re-checking.
250 |
251 |
252 | -
253 | swfAge=days
254 |
-
255 | Specify how many days to use the cached SWF info before re-checking. Use
256 | 0 to always check the SWF URL. Note that if the check shows that the
257 | SWF file has the same modification timestamp as before, it will not be
258 | retrieved again.
259 |
260 |
261 |
262 | EXAMPLES
263 | An example character string suitable for use with
264 | RTMP_SetupURL():
265 |
266 | "rtmp://flashserver:1935/ondemand/thefile swfUrl=http://flashserver/player.swf swfVfy=1"
267 |
268 |
269 |
270 | ENVIRONMENT
271 |
272 | -
273 | HOME
274 |
-
275 | The value of
276 | $HOME
277 | is used as the location for the
278 | .swfinfo
279 | file.
280 |
281 |
282 |
283 | FILES
284 |
285 | -
286 | $HOME/.swfinfo
287 |
-
288 | Cache of SWF Verification information
289 |
290 |
291 |
292 | SEE ALSO
296 |
297 | AUTHORS |