annotate ffmpeg/doc/ffserver.texi @ 13:844d341cf643 tip

Back up before ISMIR
author Yading Song <yading.song@eecs.qmul.ac.uk>
date Thu, 31 Oct 2013 13:17:06 +0000
parents 6840f77b83aa
children
rev   line source
yading@10 1 \input texinfo @c -*- texinfo -*-
yading@10 2
yading@10 3 @settitle ffserver Documentation
yading@10 4 @titlepage
yading@10 5 @center @titlefont{ffserver Documentation}
yading@10 6 @end titlepage
yading@10 7
yading@10 8 @top
yading@10 9
yading@10 10 @contents
yading@10 11
yading@10 12 @chapter Synopsis
yading@10 13
yading@10 14 ffserver [@var{options}]
yading@10 15
yading@10 16 @chapter Description
yading@10 17 @c man begin DESCRIPTION
yading@10 18
yading@10 19 @command{ffserver} is a streaming server for both audio and video. It
yading@10 20 supports several live feeds, streaming from files and time shifting on
yading@10 21 live feeds (you can seek to positions in the past on each live feed,
yading@10 22 provided you specify a big enough feed storage in
yading@10 23 @file{ffserver.conf}).
yading@10 24
yading@10 25 @command{ffserver} receives prerecorded files or FFM streams from some
yading@10 26 @command{ffmpeg} instance as input, then streams them over
yading@10 27 RTP/RTSP/HTTP.
yading@10 28
yading@10 29 An @command{ffserver} instance will listen on some port as specified
yading@10 30 in the configuration file. You can launch one or more instances of
yading@10 31 @command{ffmpeg} and send one or more FFM streams to the port where
yading@10 32 ffserver is expecting to receive them. Alternately, you can make
yading@10 33 @command{ffserver} launch such @command{ffmpeg} instances at startup.
yading@10 34
yading@10 35 Input streams are called feeds, and each one is specified by a
yading@10 36 @code{<Feed>} section in the configuration file.
yading@10 37
yading@10 38 For each feed you can have different output streams in various
yading@10 39 formats, each one specified by a @code{<Stream>} section in the
yading@10 40 configuration file.
yading@10 41
yading@10 42 @section Status stream
yading@10 43
yading@10 44 ffserver supports an HTTP interface which exposes the current status
yading@10 45 of the server.
yading@10 46
yading@10 47 Simply point your browser to the address of the special status stream
yading@10 48 specified in the configuration file.
yading@10 49
yading@10 50 For example if you have:
yading@10 51 @example
yading@10 52 <Stream status.html>
yading@10 53 Format status
yading@10 54
yading@10 55 # Only allow local people to get the status
yading@10 56 ACL allow localhost
yading@10 57 ACL allow 192.168.0.0 192.168.255.255
yading@10 58 </Stream>
yading@10 59 @end example
yading@10 60
yading@10 61 then the server will post a page with the status information when
yading@10 62 the special stream @file{status.html} is requested.
yading@10 63
yading@10 64 @section What can this do?
yading@10 65
yading@10 66 When properly configured and running, you can capture video and audio in real
yading@10 67 time from a suitable capture card, and stream it out over the Internet to
yading@10 68 either Windows Media Player or RealAudio player (with some restrictions).
yading@10 69
yading@10 70 It can also stream from files, though that is currently broken. Very often, a
yading@10 71 web server can be used to serve up the files just as well.
yading@10 72
yading@10 73 It can stream prerecorded video from .ffm files, though it is somewhat tricky
yading@10 74 to make it work correctly.
yading@10 75
yading@10 76 @section How do I make it work?
yading@10 77
yading@10 78 First, build the kit. It *really* helps to have installed LAME first. Then when
yading@10 79 you run the ffserver ./configure, make sure that you have the
yading@10 80 @code{--enable-libmp3lame} flag turned on.
yading@10 81
yading@10 82 LAME is important as it allows for streaming audio to Windows Media Player.
yading@10 83 Don't ask why the other audio types do not work.
yading@10 84
yading@10 85 As a simple test, just run the following two command lines where INPUTFILE
yading@10 86 is some file which you can decode with ffmpeg:
yading@10 87
yading@10 88 @example
yading@10 89 ffserver -f doc/ffserver.conf &
yading@10 90 ffmpeg -i INPUTFILE http://localhost:8090/feed1.ffm
yading@10 91 @end example
yading@10 92
yading@10 93 At this point you should be able to go to your Windows machine and fire up
yading@10 94 Windows Media Player (WMP). Go to Open URL and enter
yading@10 95
yading@10 96 @example
yading@10 97 http://<linuxbox>:8090/test.asf
yading@10 98 @end example
yading@10 99
yading@10 100 You should (after a short delay) see video and hear audio.
yading@10 101
yading@10 102 WARNING: trying to stream test1.mpg doesn't work with WMP as it tries to
yading@10 103 transfer the entire file before starting to play.
yading@10 104 The same is true of AVI files.
yading@10 105
yading@10 106 @section What happens next?
yading@10 107
yading@10 108 You should edit the ffserver.conf file to suit your needs (in terms of
yading@10 109 frame rates etc). Then install ffserver and ffmpeg, write a script to start
yading@10 110 them up, and off you go.
yading@10 111
yading@10 112 @section Troubleshooting
yading@10 113
yading@10 114 @subsection I don't hear any audio, but video is fine.
yading@10 115
yading@10 116 Maybe you didn't install LAME, or got your ./configure statement wrong. Check
yading@10 117 the ffmpeg output to see if a line referring to MP3 is present. If not, then
yading@10 118 your configuration was incorrect. If it is, then maybe your wiring is not
yading@10 119 set up correctly. Maybe the sound card is not getting data from the right
yading@10 120 input source. Maybe you have a really awful audio interface (like I do)
yading@10 121 that only captures in stereo and also requires that one channel be flipped.
yading@10 122 If you are one of these people, then export 'AUDIO_FLIP_LEFT=1' before
yading@10 123 starting ffmpeg.
yading@10 124
yading@10 125 @subsection The audio and video lose sync after a while.
yading@10 126
yading@10 127 Yes, they do.
yading@10 128
yading@10 129 @subsection After a long while, the video update rate goes way down in WMP.
yading@10 130
yading@10 131 Yes, it does. Who knows why?
yading@10 132
yading@10 133 @subsection WMP 6.4 behaves differently to WMP 7.
yading@10 134
yading@10 135 Yes, it does. Any thoughts on this would be gratefully received. These
yading@10 136 differences extend to embedding WMP into a web page. [There are two
yading@10 137 object IDs that you can use: The old one, which does not play well, and
yading@10 138 the new one, which does (both tested on the same system). However,
yading@10 139 I suspect that the new one is not available unless you have installed WMP 7].
yading@10 140
yading@10 141 @section What else can it do?
yading@10 142
yading@10 143 You can replay video from .ffm files that was recorded earlier.
yading@10 144 However, there are a number of caveats, including the fact that the
yading@10 145 ffserver parameters must match the original parameters used to record the
yading@10 146 file. If they do not, then ffserver deletes the file before recording into it.
yading@10 147 (Now that I write this, it seems broken).
yading@10 148
yading@10 149 You can fiddle with many of the codec choices and encoding parameters, and
yading@10 150 there are a bunch more parameters that you cannot control. Post a message
yading@10 151 to the mailing list if there are some 'must have' parameters. Look in
yading@10 152 ffserver.conf for a list of the currently available controls.
yading@10 153
yading@10 154 It will automatically generate the ASX or RAM files that are often used
yading@10 155 in browsers. These files are actually redirections to the underlying ASF
yading@10 156 or RM file. The reason for this is that the browser often fetches the
yading@10 157 entire file before starting up the external viewer. The redirection files
yading@10 158 are very small and can be transferred quickly. [The stream itself is
yading@10 159 often 'infinite' and thus the browser tries to download it and never
yading@10 160 finishes.]
yading@10 161
yading@10 162 @section Tips
yading@10 163
yading@10 164 * When you connect to a live stream, most players (WMP, RA, etc) want to
yading@10 165 buffer a certain number of seconds of material so that they can display the
yading@10 166 signal continuously. However, ffserver (by default) starts sending data
yading@10 167 in realtime. This means that there is a pause of a few seconds while the
yading@10 168 buffering is being done by the player. The good news is that this can be
yading@10 169 cured by adding a '?buffer=5' to the end of the URL. This means that the
yading@10 170 stream should start 5 seconds in the past -- and so the first 5 seconds
yading@10 171 of the stream are sent as fast as the network will allow. It will then
yading@10 172 slow down to real time. This noticeably improves the startup experience.
yading@10 173
yading@10 174 You can also add a 'Preroll 15' statement into the ffserver.conf that will
yading@10 175 add the 15 second prebuffering on all requests that do not otherwise
yading@10 176 specify a time. In addition, ffserver will skip frames until a key_frame
yading@10 177 is found. This further reduces the startup delay by not transferring data
yading@10 178 that will be discarded.
yading@10 179
yading@10 180 * You may want to adjust the MaxBandwidth in the ffserver.conf to limit
yading@10 181 the amount of bandwidth consumed by live streams.
yading@10 182
yading@10 183 @section Why does the ?buffer / Preroll stop working after a time?
yading@10 184
yading@10 185 It turns out that (on my machine at least) the number of frames successfully
yading@10 186 grabbed is marginally less than the number that ought to be grabbed. This
yading@10 187 means that the timestamp in the encoded data stream gets behind realtime.
yading@10 188 This means that if you say 'Preroll 10', then when the stream gets 10
yading@10 189 or more seconds behind, there is no Preroll left.
yading@10 190
yading@10 191 Fixing this requires a change in the internals of how timestamps are
yading@10 192 handled.
yading@10 193
yading@10 194 @section Does the @code{?date=} stuff work.
yading@10 195
yading@10 196 Yes (subject to the limitation outlined above). Also note that whenever you
yading@10 197 start ffserver, it deletes the ffm file (if any parameters have changed),
yading@10 198 thus wiping out what you had recorded before.
yading@10 199
yading@10 200 The format of the @code{?date=xxxxxx} is fairly flexible. You should use one
yading@10 201 of the following formats (the 'T' is literal):
yading@10 202
yading@10 203 @example
yading@10 204 * YYYY-MM-DDTHH:MM:SS (localtime)
yading@10 205 * YYYY-MM-DDTHH:MM:SSZ (UTC)
yading@10 206 @end example
yading@10 207
yading@10 208 You can omit the YYYY-MM-DD, and then it refers to the current day. However
yading@10 209 note that @samp{?date=16:00:00} refers to 16:00 on the current day -- this
yading@10 210 may be in the future and so is unlikely to be useful.
yading@10 211
yading@10 212 You use this by adding the ?date= to the end of the URL for the stream.
yading@10 213 For example: @samp{http://localhost:8080/test.asf?date=2002-07-26T23:05:00}.
yading@10 214 @c man end
yading@10 215
yading@10 216 @section What is FFM, FFM2
yading@10 217
yading@10 218 FFM and FFM2 are formats used by ffserver. They allow storing a wide variety of
yading@10 219 video and audio streams and encoding options, and can store a moving time segment
yading@10 220 of an infinite movie or a whole movie.
yading@10 221
yading@10 222 FFM is version specific, and there is limited compatibility of FFM files
yading@10 223 generated by one version of ffmpeg/ffserver and another version of
yading@10 224 ffmpeg/ffserver. It may work but it is not guaranteed to work.
yading@10 225
yading@10 226 FFM2 is extensible while maintaining compatibility and should work between
yading@10 227 differing versions of tools. FFM2 is the default.
yading@10 228
yading@10 229 @chapter Options
yading@10 230 @c man begin OPTIONS
yading@10 231
yading@10 232 @include avtools-common-opts.texi
yading@10 233
yading@10 234 @section Main options
yading@10 235
yading@10 236 @table @option
yading@10 237 @item -f @var{configfile}
yading@10 238 Use @file{configfile} instead of @file{/etc/ffserver.conf}.
yading@10 239 @item -n
yading@10 240 Enable no-launch mode. This option disables all the Launch directives
yading@10 241 within the various <Stream> sections. Since ffserver will not launch
yading@10 242 any ffmpeg instances, you will have to launch them manually.
yading@10 243 @item -d
yading@10 244 Enable debug mode. This option increases log verbosity, directs log
yading@10 245 messages to stdout.
yading@10 246 @end table
yading@10 247 @c man end
yading@10 248
yading@10 249 @ifset config-all
yading@10 250 @include all-components.texi
yading@10 251 @end ifset
yading@10 252
yading@10 253 @chapter See Also
yading@10 254
yading@10 255 @ifhtml
yading@10 256 @ifset config-all
yading@10 257 @url{ffserver.html,ffserver},
yading@10 258 @end ifset
yading@10 259 @ifset config-not-all
yading@10 260 @url{ffserver-all.html,ffserver-all},
yading@10 261 @end ifset
yading@10 262 the @file{doc/ffserver.conf} example,
yading@10 263 @url{ffmpeg.html,ffmpeg}, @url{ffplay.html,ffplay}, @url{ffprobe.html,ffprobe},
yading@10 264 @url{ffmpeg-utils.html,ffmpeg-utils},
yading@10 265 @url{ffmpeg-scaler.html,ffmpeg-scaler},
yading@10 266 @url{ffmpeg-resampler.html,ffmpeg-resampler},
yading@10 267 @url{ffmpeg-codecs.html,ffmpeg-codecs},
yading@10 268 @url{ffmpeg-bitstream-filters.html,ffmpeg-bitstream-filters},
yading@10 269 @url{ffmpeg-formats.html,ffmpeg-formats},
yading@10 270 @url{ffmpeg-devices.html,ffmpeg-devices},
yading@10 271 @url{ffmpeg-protocols.html,ffmpeg-protocols},
yading@10 272 @url{ffmpeg-filters.html,ffmpeg-filters}
yading@10 273 @end ifhtml
yading@10 274
yading@10 275 @ifnothtml
yading@10 276 @ifset config-all
yading@10 277 ffserver(1),
yading@10 278 @end ifset
yading@10 279 @ifset config-not-all
yading@10 280 ffserver-all(1),
yading@10 281 @end ifset
yading@10 282 the @file{doc/ffserver.conf} example, ffmpeg(1), ffplay(1), ffprobe(1),
yading@10 283 ffmpeg-utils(1), ffmpeg-scaler(1), ffmpeg-resampler(1),
yading@10 284 ffmpeg-codecs(1), ffmpeg-bitstream-filters(1), ffmpeg-formats(1),
yading@10 285 ffmpeg-devices(1), ffmpeg-protocols(1), ffmpeg-filters(1)
yading@10 286 @end ifnothtml
yading@10 287
yading@10 288 @include authors.texi
yading@10 289
yading@10 290 @ignore
yading@10 291
yading@10 292 @setfilename ffserver
yading@10 293 @settitle ffserver video server
yading@10 294
yading@10 295 @end ignore
yading@10 296
yading@10 297 @bye