You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

282 lines
10.0KB

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