More for input buffer checks
[rtmpdump.git] / librtmp / librtmp.3
blob7c424aa7b7dcae544569fdd01347c7b387c7e352
1 .TH LIBRTMP 3 "2011-07-20" "RTMPDump v2.4"
2 .\" Copyright 2011 Howard Chu.
3 .\" Copying permitted according to the GNU General Public License V2.
4 .SH NAME
5 librtmp \- RTMPDump Real-Time Messaging Protocol API
6 .SH LIBRARY
7 RTMPDump RTMP (librtmp, -lrtmp)
8 .SH SYNOPSIS
9 .B #include <librtmp/rtmp.h>
10 .SH DESCRIPTION
11 The Real-Time Messaging Protocol (RTMP) is used for streaming
12 multimedia content across a TCP/IP network. This API provides most client
13 functions and a few server functions needed to support RTMP, RTMP tunneled
14 in HTTP (RTMPT), encrypted RTMP (RTMPE), RTMP over SSL/TLS (RTMPS) and
15 tunneled variants of these encrypted types (RTMPTE, RTMPTS). The basic
16 RTMP specification has been published by Adobe but this API was
17 reverse-engineered without use of the Adobe specification. As such, it may
18 deviate from any published specifications but it usually duplicates the
19 actual behavior of the original Adobe clients.
21 The RTMPDump software package includes a basic client utility program
23 .BR rtmpdump (1),
24 some sample servers, and a library used to provide programmatic access
25 to the RTMP protocol. This man page gives an overview of the RTMP
26 library routines. These routines are found in the -lrtmp library. Many
27 other routines are also available, but they are not documented yet.
29 The basic interaction is as follows. A session handle is created using
30 .BR RTMP_Alloc ()
31 and initialized using
32 .BR RTMP_Init ().
33 All session parameters are provided using
34 .BR RTMP_SetupURL ().
35 The network connection is established using
36 .BR RTMP_Connect (),
37 and then the RTMP session is established using
38 .BR RTMP_ConnectStream ().
39 The stream is read using
40 .BR RTMP_Read ().
41 A client can publish a stream by calling
42 .BR RTMP_EnableWrite ()
43 before the
44 .BR RTMP_Connect ()
45 call, and then using
46 .BR RTMP_Write ()
47 after the session is established.
48 While a stream is playing it may be paused and unpaused using
49 .BR RTMP_Pause ().
50 The stream playback position can be moved using
51 .BR RTMP_Seek ().
52 When
53 .BR RTMP_Read ()
54 returns 0 bytes, the stream is complete and may be closed using
55 .BR RTMP_Close ().
56 The session handle is freed using
57 .BR RTMP_Free ().
59 All data is transferred using FLV format. The basic session requires
60 an RTMP URL.  The RTMP URL format is of the form
61 .nf
62   rtmp[t][e|s]://hostname[:port][/app[/playpath]]
63 .fi
65 Plain rtmp, as well as tunneled and encrypted sessions are supported.
67 Additional options may be specified by appending space-separated
68 key=value pairs to the URL. Special characters in values may need
69 to be escaped to prevent misinterpretation by the option parser.
70 The escape encoding uses a backslash followed by two hexadecimal digits
71 representing the ASCII value of the character. E.g., spaces must
72 be escaped as \fB\\20\fP and backslashes must be escaped as \fB\\5c\fP.
73 .SH OPTIONS
74 .SS "Network Parameters"
75 These options define how to connect to the media server.
76 .TP
77 .BI socks= host:port
78 Use the specified SOCKS4 proxy.
79 .SS "Connection Parameters"
80 These options define the content of the RTMP Connect request packet.
81 If correct values are not provided, the media server will reject the
82 connection attempt.
83 .TP
84 .BI app= name
85 Name of application to connect to on the RTMP server. Overrides
86 the app in the RTMP URL. Sometimes the librtmp URL parser cannot
87 determine the app name automatically, so it must be given explicitly
88 using this option.
89 .TP
90 .BI tcUrl= url
91 URL of the target stream. Defaults to rtmp[t][e|s]://host[:port]/app.
92 .TP
93 .BI pageUrl= url
94 URL of the web page in which the media was embedded. By default no
95 value will be sent.
96 .TP
97 .BI swfUrl= url
98 URL of the SWF player for the media. By default no value will be sent.
99 .TP
100 .BI flashVer= version
101 Version of the Flash plugin used to run the SWF player. The
102 default is "LNX 10,0,32,18".
104 .BI conn= type:data
105 Append arbitrary AMF data to the Connect message. The type
106 must be B for Boolean, N for number, S for string, O for object, or Z
107 for null. For Booleans the data must be either 0 or 1 for FALSE or TRUE,
108 respectively. Likewise for Objects the data must be 0 or 1 to end or
109 begin an object, respectively. Data items in subobjects may be named, by
110 prefixing the type with 'N' and specifying the name before the value, e.g.
111 NB:myFlag:1. This option may be used multiple times to construct arbitrary
112 AMF sequences. E.g.
114   conn=B:1 conn=S:authMe conn=O:1 conn=NN:code:1.23 conn=NS:flag:ok conn=O:0
116 .SS "Session Parameters"
117 These options take effect after the Connect request has succeeded.
119 .BI playpath= path
120 Overrides the playpath parsed from the RTMP URL. Sometimes the
121 rtmpdump URL parser cannot determine the correct playpath
122 automatically, so it must be given explicitly using this option.
124 .BI playlist= 0|1
125 If the value is 1 or TRUE, issue a set_playlist command before sending the
126 play command. The playlist will just contain the current playpath. If the
127 value is 0 or FALSE, the set_playlist command will not be sent. The
128 default is FALSE.
130 .BI live= 0|1
131 Specify that the media is a live stream. No resuming or seeking in
132 live streams is possible.
134 .BI subscribe= path
135 Name of live stream to subscribe to. Defaults to
136 .IR playpath .
138 .BI start= num
139 Start at
140 .I num
141 seconds into the stream. Not valid for live streams.
143 .BI stop= num
144 Stop at
145 .I num
146 seconds into the stream.
148 .BI buffer= num
149 Set buffer time to
150 .I num
151 milliseconds. The default is 30000.
153 .BI timeout= num
154 Timeout the session after
155 .I num
156 seconds without receiving any data from the server. The default is 120.
157 .SS "Security Parameters"
158 These options handle additional authentication requests from the server.
160 .BI token= key
161 Key for SecureToken response, used if the server requires SecureToken
162 authentication.
164 .BI jtv= JSON
165 JSON token used by legacy Justin.tv servers. Invokes NetStream.Authenticate.UsherToken
167 .BI swfVfy= 0|1
168 If the value is 1 or TRUE, the SWF player is retrieved from the
169 specified
170 .I swfUrl
171 for performing SWF Verification.  The SWF hash and size (used in the
172 verification step) are computed automatically. Also the SWF information is
173 cached in a
174 .I .swfinfo
175 file in the user's home directory, so that it doesn't need to be retrieved
176 and recalculated every time. The .swfinfo file records
177 the SWF URL, the time it was fetched, the modification timestamp of the SWF
178 file, its size, and its hash. By default, the cached info will be used
179 for 30 days before re-checking.
181 .BI swfAge= days
182 Specify how many days to use the cached SWF info before re-checking. Use
183 0 to always check the SWF URL. Note that if the check shows that the
184 SWF file has the same modification timestamp as before, it will not be
185 retrieved again.
186 .SH EXAMPLES
187 An example character string suitable for use with
188 .BR RTMP_SetupURL ():
190   "rtmp://flashserver:1935/ondemand/thefile swfUrl=http://flashserver/player.swf swfVfy=1"
192 .SH ENVIRONMENT
194 .B HOME
195 The value of
196 .RB $ HOME
197 is used as the location for the
198 .I .swfinfo
199 file.
200 .SH FILES
202 .I $HOME/.swfinfo
203 Cache of SWF Verification information
204 .SH "SEE ALSO"
205 .BR rtmpdump (1),
206 .BR rtmpgw (8)
207 .SH AUTHORS
208 Andrej Stepanchuk, Howard Chu, The Flvstreamer Team
210 <http://rtmpdump.mplayerhq.hu>